Can't run integration tests in a clean git clone (sonar-java)

106 views
Skip to first unread message

Fernando García

unread,
Nov 15, 2016, 8:31:46 PM11/15/16
to SonarQube
Hi guys,

I 'm just trying to follow this apparently simple guide: https://github.com/SonarSource/sonar-java#topic-in-sonarqube-google-group

I can build the project using mvn clean install, but when I do mvn clean install -Pit-plugin, it fails.

Some outputs I see:

From mvn clean install -Pit-plugin:

Running com.sonar.it.java.suite.JavaTestSuite
Tests run: 51, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 631.286 sec <<< FAILURE! - in com.sonar.it.java.suite.JavaTestSuite
should_execute_rule_on_test(com.sonar.it.java.suite.JavaTest)  Time elapsed: 13.015 sec  <<< ERROR!
com.sonar.orchestrator.build.BuildFailureException: status=1 build=[com.sonar.orchestrator.build.MavenBuild@21282ed8]
at com.sonar.orchestrator.build.BuildRunner.run(BuildRunner.java:47)
at com.sonar.orchestrator.Orchestrator.executeBuildInternal(Orchestrator.java:220)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:202)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:198)
at com.sonar.it.java.suite.JavaTest.should_execute_rule_on_test(JavaTest.java:205)

should_use_new_java_libraries_property(com.sonar.it.java.suite.JavaClasspathTest)  Time elapsed: 3.059 sec  <<< ERROR!
com.sonar.orchestrator.build.BuildFailureException: status=1 build=[com.sonar.orchestrator.build.SonarScanner@4c1909a3]
at com.sonar.orchestrator.build.BuildRunner.run(BuildRunner.java:47)
at com.sonar.orchestrator.Orchestrator.executeBuildInternal(Orchestrator.java:220)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:202)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:198)
at com.sonar.it.java.suite.JavaClasspathTest.should_use_new_java_libraries_property(JavaClasspathTest.java:118)

should_keep_order_libs(com.sonar.it.java.suite.JavaClasspathTest)  Time elapsed: 2.965 sec  <<< ERROR!
com.sonar.orchestrator.build.BuildFailureException: status=1 build=[com.sonar.orchestrator.build.SonarScanner@d9345cd]
at com.sonar.orchestrator.build.BuildRunner.run(BuildRunner.java:47)
at com.sonar.orchestrator.Orchestrator.executeBuildInternal(Orchestrator.java:220)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:202)
at com.sonar.orchestrator.Orchestrator.executeBuild(Orchestrator.java:198)
at com.sonar.it.java.suite.JavaClasspathTest.should_keep_order_libs(JavaClasspathTest.java:128)


Results :


Tests in error: 
  JavaClasspathTest.should_keep_order_libs:128 » BuildFailure status=1 build=[co...
  JavaClasspathTest.should_use_new_java_libraries_property:118 » BuildFailure st...
  JavaTest.should_execute_rule_on_test:205 » BuildFailure status=1 build=[com.so...



[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] SonarQube Java ..................................... SUCCESS [  2.524 s]
[INFO] SonarQube Java :: Maven model generator ............ SUCCESS [  7.289 s]
[INFO] SonarQube Java :: Front-end ........................ SUCCESS [01:31 min]
[INFO] SonarQube Java :: Check Test tool kit .............. SUCCESS [  6.452 s]
[INFO] SonarQube Java :: Checks ........................... SUCCESS [ 42.680 s]
[INFO] SonarQube Java :: Surefire ......................... SUCCESS [  3.343 s]
[INFO] java-jacoco-previous ............................... SUCCESS [  0.723 s]
[INFO] SonarQube Java :: JaCoCo ........................... SUCCESS [  2.396 s]
[INFO] SonarQube Java :: Plugin ........................... SUCCESS [  8.671 s]
[INFO] SonarQube Java :: JaCoCo Listeners ................. SUCCESS [  1.852 s]
[INFO] SonarQube Java :: ITs .............................. SUCCESS [  0.051 s]
[INFO] SonarQube Java :: ITs :: Performancing ............. SUCCESS [  0.380 s]
[INFO] SonarQube Java :: ITs :: Plugin .................... SUCCESS [  0.049 s]
[INFO] SonarQube Java :: ITs :: Plugin :: Plugins ......... SUCCESS [  0.037 s]
[INFO] SonarQube Java :: IT :: Plugins :: Java Extension Plugin SUCCESS [  2.670 s]
[INFO] SonarQube Java :: ITs :: Plugin :: Tests ........... FAILURE [10:32 min]
[INFO] SonarQube Java :: ITs :: Ruling .................... SKIPPED


If I check target/surefire-reports, I see errors like:

Caused by: java.lang.IllegalStateException: No files nor directories matching '/tmp/junit2410743792373123914/junit-4.11.jar'
at org.sonar.java.AbstractJavaClasspath.getFilesFromProperty(AbstractJavaClasspath.java:92)
at org.sonar.java.JavaTestClasspath.init(JavaTestClasspath.java:48)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:273)
at org.sonar.java.SonarComponents.getJavaTestClasspath(SonarComponents.java:128)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:79)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:86)

 
Caused by: java.lang.IllegalStateException: No files nor directories matching '/tmp/junit4630726724007436271/subFolder/subSubFolder/guava-10.0.1.jar'
at org.sonar.java.AbstractJavaClasspath.getFilesFromProperty(AbstractJavaClasspath.java:92)
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:50)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:273)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:124)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:78)

 
Also:

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: No files nor directories matching '/tmp/junit7354648706716423263/subFolder/subSubFolder/guava-10.0.1.jar'
at org.sonar.java.AbstractJavaClasspath.getFilesFromProperty(AbstractJavaClasspath.java:92)
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:50)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:273)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:124)
at org.sonar.java.JavaSquid.<init>(JavaSquid.java:78)


 If I go to: com.sonar.it.java.suite.JavaTestSuite-output.txt, I see:

org.apache.maven.surefire.util.SurefireReflectionException: org.sonar.java.jacoco.JacocoController$JacocoControllerError: Unable to access JaCoCo Agent - make sure that you use JaCoCo and version not lower than 0.6.2.
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:134)

[...]
 
Caused by: java.lang.NoClassDefFoundError: org/jacoco/agent/rt/RT
at org.sonar.java.jacoco.JacocoController.<init>(JacocoController.java:39)
... 19 more

 

And when I import the projects in Eclipse, all of them look fine, except java-jacoco, that is showing this error: org.jacoco.previous cannot be resolved to a type

I am using Linux and Eclipse. I also tried to do exactly the same under Windows and similar things are happening (the same issue with not finding tem junit files).
I'm worried, because I just cloned the project and the regression tests are failing, so I wonder what's wrong in my end.

 Can't see too much in Google, that's why I'm asking here.

Thanks a lot for your help!

Fernando García

unread,
Nov 18, 2016, 6:58:11 AM11/18/16
to SonarQube
Sorry, bumping it to see if someone has any idea.
I'll keep trying tomorrow anyway, but I need integration tests running to fix some bugs

Thanks!

G. Ann Campbell

unread,
Nov 18, 2016, 7:42:31 AM11/18/16
to SonarQube
Hi Fernando,

When I followed that guide recently, it worked fine. Are you sure you set up the properties file and the env var pointing to it correctly?


Ann

Fernando García

unread,
Nov 20, 2016, 7:29:52 AM11/20/16
to SonarQube
Hi Ann,
Yes, it is correctly configured. I can do everything except mvn clean install -Pit-plugin.
Looks like it's some other problem not related to sonar project, but I tried both in Windows and Linux and couldn't successfully run that command.

Thanks for your reply!

micke...@gmail.com

unread,
Mar 26, 2017, 10:37:50 AM3/26/17
to SonarQube
Hi Fernando,

I'm a little late to the party perhaps but I just encountered the same problem (both Linux and Mac). After some digging I concluded that there was a problem copying files from the local Maven repository (which the test could not find). So I got it working by adding the property maven.localRepository, pointing to <home folder>/.m2/repository, in the property file. Don't know if this should be required, since the guide doesn't mention it, but it worked for me at least.

Best regards
Michael

Nicolas Peru

unread,
May 10, 2017, 3:40:57 AM5/10/17
to micke...@gmail.com, SonarQube
Hi, 

Sorry for late reply, but I do confirm your analysis Michael. 


Cheers, 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/283ac5c5-6310-47f6-a5d3-9c2b50fe3216%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource

michae...@klarna.com

unread,
May 10, 2017, 4:08:38 AM5/10/17
to SonarQube, micke...@gmail.com
Great that it's added to the documentation and thanks for the feedback!

/Michael
Reply all
Reply to author
Forward
0 new messages