SonarLint for Eclipse: Exception during analysis for missing test-classes directory

1,496 views
Skip to first unread message

Christian

unread,
Feb 9, 2017, 11:48:17 AM2/9/17
to SonarLint
Hi SonarLint-Team,

in a maven project we have a src/test/java directory which is empty. This causes maven to skip creating the target/test-classes directory. Still, it is referenced by the eclipse project as a target directory for compiling src/test/java (if that matters).
SonarLint prints an exception to console whenever a Java file from src/main/java in this project is opened (see below).
It seems related to this issue, but not the same problem.
Creating the folder helps, but only until the next mvn clean, obviously.

Best regards,
Christian

Error during analysis
java.lang.IllegalStateException: No files nor directories matching 'D:/.../target/test-classes'
at org.sonar.java.AbstractJavaClasspath.getFilesFromProperty(AbstractJavaClasspath.java:90)
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:49)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:271)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:122)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:78)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:86)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorWrapper.analyse(SensorWrapper.java:52)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:73)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:63)
at org.sonarsource.sonarlint.core.analyzer.sensor.PhaseExecutor.execute(PhaseExecutor.java:44)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:143)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:72)
at org.sonarsource.sonarlint.core.container.storage.StorageContainer.analyze(StorageContainer.java:125)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:158)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:145)
at org.sonarlint.eclipse.core.internal.server.Server.runAnalysis(Server.java:264)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:407)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob$AnalysisThread.run(AnalyzeProjectJob.java:124)

Julien HENRY

unread,
Feb 9, 2017, 11:58:44 AM2/9/17
to Christian, SonarLint
Hi Christian,

What is your version of m2e? I tried to reproduce, but even with an empty src/test/java directory, the folder target/test-classes is created.

++

Julien

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/b74aa3af-83e8-4c1a-b40a-b4a8ced77d0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian

unread,
Feb 10, 2017, 7:34:34 AM2/10/17
to SonarLint, christian0...@conti.de
It's org.eclipse.m2e.feature 1.6.2.20150902-0002, but I suspect it's rather the Maven version 3.3.3. Because at the cli it also does not create the target/test-classes.

patrick.steinig

unread,
Feb 16, 2017, 2:21:40 AM2/16/17
to SonarLint, christian0...@conti.de
I just stumbled over the same issue.
It works if I use only eclipse m2e (version 1.7.x).  But as soon as I build with mvn commandline ('mvn clean install') the test-classes folder is removed and not created again if the src/test/java is empty or not existent.

duarte.meneses

unread,
Feb 22, 2017, 10:50:34 AM2/22/17
to SonarLint, christian0...@conti.de
I've created a ticket for this issue: https://jira.sonarsource.com/browse/SLE-159
Reply all
Reply to author
Forward
0 new messages