Maven scanner fails to run

Must-share information (formatted with Markdown):

  • sonarqube-developer-8.3.1.34397, runs on localhost:9000 with startsonar.bat
  • our code compiles with java7 and maven3.0.4
  • trying to simply run the scanner against the sonarqube evaluation to see the results
  • error

[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:4.3:sonar (default-cli) on project fa-sh-root: Fail to download libraries from server: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:4.3:sonar (default-cli) on project fa-sh-root: Fail to download libraries from server
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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: Fail to download libraries from server
at org.sonar.maven.ExceptionHandling.handle(ExceptionHandling.java:37)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:175)
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: Fail to download libraries from server
at org.sonar.runner.impl.Jars35.dowloadFiles(Jars35.java:78)
at org.sonar.runner.impl.Jars35.download(Jars35.java:57)
at org.sonar.runner.impl.JarDownloader.download35(JarDownloader.java:56)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
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:90)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:173)
… 21 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.sonar.runner.impl.Jars35.dowloadFiles(Jars35.java:72)
… 31 more

Command used:
mvn sonar:sonar
-Dsonar.projectKey=FASHARED
-Dsonar.host.url=http://localhost:9000
-Dsonar.login=f02f65816ae6130340272ab5b390d919cf027776
-Dsonar.java.source=1.7

This… is old. :laughing: And I can understand why it would be confusing (I have not been around long enough to understand what this was)

Try what is referenced in the documentation for the SonarScanner for Maven

org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar
1 Like

Hi @Colin,
The latest version available on Maven Central is 3.7.0.1746.

Is the documentation outdated or shall we stick to the older version?
In my company we use 3.7.0.1746 without any issues.

Best Regards,
Matthias

The latest version is fine! The documentation could use a bump. I’ll submit a PR.

1 Like

Thanks Colin. That seems to work.
I would suggest modifying the instructions in the web interface to provide more detail.
In our case the command “mvn sonar:sonar” from these instructions activates org.codehaus.sonar:sonar-maven-plugin:4.3:sonar.
No idea why as we did not configure this.
Using mvn org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar resolved the issue.