Sonar Maven plugin (3.0.1, 3.0) intermittent build failures

574 views
Skip to first unread message

Arpad Toman-Marton

unread,
Apr 7, 2016, 8:19:05 AM4/7/16
to SonarQube, arpad...@synchronoss.com
Hi All,

With the latest Sonar Maven plugins (3.0 and 3.0.1) our builds sometimes fail with the following error message:

[ERROR] [14:51:31.723] Invalid value of sonar.sources for masked.sandbox:module1
[DEBUG] [14:51:32.252] To prevent a memory leak, the JDBC Driver [oracle.jdbc.OracleDriver] has been forcibly deregistered
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] masked-sandbox ................................... FAILURE [17.453s]
[INFO] module1 ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.725s
[INFO] Finished at: Fri Apr 01 14:51:32 UTC 2016
[INFO] Final Memory: 36M/348M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project masked-sandbox: The folder '/opt/build-dir/WLC-SBDEV-JOB1/module1/pom.xml' does not exist for 'masked.sandbox:module1' (base directory = /opt/build-dir/WLC-SBDEV-JOB1/module1) -> [Help 1]
org
.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project masked-sandbox: The folder '/opt/build-dir/WLC-SBDEV-JOB1/module1/pom.xml' does not exist for 'masked.sandbox:module1' (base directory = /opt/build-dir/WLC-SBDEV-JOB1/module1)
        at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org
.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org
.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org
.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org
.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org
.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org
.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org
.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org
.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org
.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:483)
        at org
.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org
.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org
.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org
.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: The folder '/opt/build-dir/WLC-SBDEV-JOB1/module1/pom.xml' does not exist for 'masked.sandbox:module1' (base directory = /opt/build-dir/WLC-SBDEV-JOB1/module1)
        at org
.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
        at org
.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:81)
        at org
.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
        at org
.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org
.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
       
... 19 more
Caused by: java.lang.IllegalStateException: The folder '/opt/build-dir/WLC-SBDEV-JOB1/module1/pom.xml' does not exist for 'masked.sandbox:module1' (base directory = /opt/build-dir/WLC-SBDEV-JOB1/module1)
        at org
.sonar.batch.scan.ProjectReactorBuilder.checkExistenceOfDirectories(ProjectReactorBuilder.java:423)
        at org
.sonar.batch.scan.ProjectReactorBuilder.cleanAndCheckModuleProperties(ProjectReactorBuilder.java:336)
        at org
.sonar.batch.scan.ProjectReactorBuilder.cleanAndCheckProjectDefinitions(ProjectReactorBuilder.java:319)
        at org
.sonar.batch.scan.ProjectReactorBuilder.cleanAndCheckProjectDefinitions(ProjectReactorBuilder.java:325)
        at org
.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:117)
        at org
.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:95)
        at org
.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:72)
        at org
.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
        at org
.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org
.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
        at org
.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
        at org
.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
        at org
.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org
.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org
.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
        at org
.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
        at org
.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org
.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org
.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
        at org
.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
        at org
.sonar.runner.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:86)
        at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java
.lang.reflect.Method.invoke(Method.java:483)
        at org
.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
        at com
.sun.proxy.$Proxy16.executeOldVersion(Unknown Source)
        at org
.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:283)
        at org
.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
        at org
.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
        at org
.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:78)
       
... 22 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
        Failing task since return code of [/opt/apache-maven-3.0.5/bin/mvn --batch-mode -Djava.io.tmpdir=/tmp/WLC-SBDEV-JOB1 sonar:sonar -U -X] was 1 while expected 0
       
Finished task 'sonar:sonar' with result: Failed

The problem does not occur with the 2.6 version. Based on some debugging this is a multithreading issue, because if the execution is slower the plugin works correctly. After going through the sources the changes done as part of this issue are partially responsible, because previously the POM files were not considered as a source to be analysed by default. Could you please look into it? Thank you.

Versions:
  • Maven: 3.0.5, 3.3.3, 3.3.9
  • Java: 1.8.0_60
  • SonarQube: 4.3.3
  • Sonar Maven Plugin: 3.0.1, 3.0

Julien HENRY

unread,
Apr 7, 2016, 8:42:57 AM4/7/16
to SonarQube, arpad...@synchronoss.com
Hi!

Could you please provide the version of SonarQube (server) you are using?

Is there anything special in your Maven build that would explain why the file /opt/build-dir/WLC-SBDEV-JOB1/module1/pom.xml would be missing? In JIRA you talked about concurrency issue. Are you running Maven with parallel options enabled?

++

Julien
...

Arpad Toman-Marton

unread,
Apr 7, 2016, 8:51:29 AM4/7/16
to SonarQube, arpad...@synchronoss.com
Hi,

Yes, the SonarQube version is 4.3.3 and there is nothing special about the project. The file is there, but for some reason Sonar treats it as a folder.

Regarding the Maven command we are running it single-threaded.

Best Regards,
Arpad

Julien HENRY

unread,
Apr 7, 2016, 9:05:47 AM4/7/16
to SonarQube, arpad...@synchronoss.com
SonarQube 4.3.3 is no more supported. You should update to at least the LTS (4.5.6). If for some reason you can't then you should lock the version of the Maven plugin to an old version.

You should have a WARN log saying:
"With SonarQube prior to 4.5, it is recommended to use maven-sonar-plugin 2.6"

Is it not the case?

Arpad Toman-Marton

unread,
Apr 7, 2016, 9:45:18 AM4/7/16
to SonarQube, arpad...@synchronoss.com
Hi,

Yes, it is the case and it works fine with 2.6. However, the newer plugins also do sometimes. Do you think this could be a server issue?

Arpad

Julien HENRY

unread,
Apr 7, 2016, 10:41:01 AM4/7/16
to SonarQube, arpad...@synchronoss.com
I'm sorry but I don't see how it could work. SonarQube 4.3.3 was not supporting passing files to sonar.sources so it is expected that it fails on pom.xml.
Reply all
Reply to author
Forward
0 new messages