Unable to execute SonarQube: Fail to download libraries from server

I’ve installed SonarCube Developer Version 8.9.3.48735 LTS on a new Server which I plan on activating with a trail licence key once I can see the coverage etc. The server is up and running using OpenJDK 11 and I can navigate to the project dashboard OK.

When I add a Sonar installation using the Manage Jenkins ==> configure ==> AddSonarCube option, I can add an entry to point to the above server.

When I edit the Jenkins build job, I can select the above installation from the drop down but I see the error below when the Jenkins build runs. The SonarCube Plugin currently installed on the build server under the Jenkins ==> Plugin Manager option is version 2.2.1.
I don’t want to update this plugin as older build jobs appear to using this and another SonarCube installation version 5.12.

I tried adding the following plugin to my project POM but the build still fails:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>2.7.1</version>
    </plugin>
</plugins>
</pluginManagement> 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.423 s
[INFO] Finished at: 2021-12-02T09:52:17+00:00
[INFO] Final Memory: 40M/257M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project XXXXXXX: Fail to download libraries from server -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project XXXXXXX: Fail to download libraries from server
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    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:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to download libraries from server
    at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:104)
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:135)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 20 more
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
    at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:94)
    at org.sonar.runner.impl.Jars.download(Jars.java:71)
    at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
    at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
    at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
    at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
    at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:250)
    at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:188)
    at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:183)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:77)
    ... 23 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:88)
    ... 34 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
SonarQube analysis completed: FAILURE
Build step 'SonarQube' changed build result to FAILURE
Build step 'SonarQube' marked build as failure
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE

Any ideas how I can get this build job running to provide coverage on the new server?

Hi,

You should remove that sonar-maven-plugin configuration from your POM. It’s pinning analysis to use a very old and unsupported version of the Scanner for Maven. Drop that configuration, and the latest version will automatically be used.

Regarding the projects using a SonarQube 5.1.2 installation, you should start them over on your new instance immediately.

 
Ann

Hi Ann,

When you say

are you referring to uninstalling the 2.2.1 version of the plugin under Jenkins ==> Plugin Manager? If I disable this plugin by unchecking the radio button, I don’t have the option of adding SonarCube as post build step in my build job.

Thanks,

Oran.

Hi Oran,

I’m not recommending any changes in Jenkins.

You modified the pom

I’m saying you should unmodify it. Remove that plugin configuration.

 
Ann

Hi Ann,

I made those changes to the POM after the build had failed initially.

I’ve removed the plugin changes from the POM again and this is the error I’m currently getting:

> [INFO] Total time: 5.070 s
> [INFO] Finished at: 2021-12-10T08:33:23+00:00
> [INFO] Final Memory: 38M/256M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project XXXXXX: Fail to download libraries from server -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project XXXXXX: Fail to download libraries from server
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
> 	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:116)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
> 	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:497)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to download libraries from server
> 	at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
> 	at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:104)
> 	at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:135)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
> 	... 20 more
> Caused by: java.lang.IllegalStateException: Fail to download libraries from server
> 	at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:94)
> 	at org.sonar.runner.impl.Jars.download(Jars.java:71)
> 	at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
> 	at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
> 	at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
> 	at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
> 	at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:250)
> 	at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:188)
> 	at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:183)
> 	at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:77)
> 	... 23 more
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
> 	at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:88)
> 	... 34 more
> [ERROR] 
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [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
> SonarQube analysis completed: FAILURE
> Build step 'SonarQube' changed build result to FAILURE
> Build step 'SonarQube' marked build as failure
> Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
> Finished: FAILURE

As a side note, I tried building the project locally from the command line using mvn sonar:sonar and that was successful so it looks like the issue might relate to Jenkins.

I have Maven 3.3.3 installed both locally and on the Jenkins build server.

Hi,

Yes, it seems that somewhere you still have an old version of the Maven task pinned. I supposed I would start my search in the Maven settings on the Jenkins server/build agents.

 
Ann