0
votes

Recently we shifted from java 7 to java 8 in our code base, our sonar build started failing (This was working with Java 7). Mentioning the details of our system:

  1. Java version - 8
  2. SonarQube: 2.0.1
  3. Jenkins: Jenkins ver. 1.653
  4. Sonar-maven-plugin: 2.0 (hard coded in parent pom.xml)

Below is the log :

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project XXX: Can not execute SonarQube analysis
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:319)
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:498)
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: Can not execute SonarQube analysis
at org.codehaus.mojo.sonar.bootstrap.InternalMojoBootstraper.executeMojo(InternalMojoBootstraper.java:111)
at org.codehaus.mojo.sonar.bootstrap.InternalMojoBootstraper.start(InternalMojoBootstraper.java:69)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:142)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:20
1
The log says that you are using sonar-maven-plugin 2.5 and not 2.0 as you mention in the text (org.codehaus.mojo:sonar-maven-plugin:2.5:sonar). - FrVaBe
Btw which version of maven are you using? - Hrabosch
You're seriously trying to use a SonarQube version that's nearly 7 years old with Java 8? - G. Ann - SonarSource Team
@G.Ann-SonarSourceTeam I am basically trying to find what all upgrades i need to do, in Sonar and Sonar plugin to get it working with Java 8. The information would be really useful. Maven version used is 3. - DJones

1 Answers

0
votes

SonarQube 2.0.1 is simply not going to work with Java 8. Start by upgrading your server to at least the most recent LTS version (5.6 at this writing). Then remove the hard-coded maven plugin (which I believe is also not going to work with Java 8). And you should be good to go.