ENVIRONMENT
Jenkins 2.23
SonarQube plugin 2.4.4
SonarQube 6.0
Java plugin 4.2
Findbugs plugin 3.4.3
Clirr 1.3
(some other plugins, probably not relevant for this issue, but feel free to ask in the comments and I´ll edit the question)
I have a multi-module Maven project with one root module (pom packaging, no code) and several child modules (jar packaging, code). I´m running SonarQube analysis in a Maven job in Jenkins.
PROBLEM DESCRIPTION
Analysis worked ok in SQ 5.x. Since upgrading to SQ 6.0, the analysis fails:
the analysis on the child modules succeeds
the analysis on the root module fails with error:
[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on
project root:
org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
-> [Help 1]
ALREADY TRIED
excluding the root module from analysis --> results in Maven error
Unable to determine structure of project. Probably you use Maven
Advanced Reactor Options with a broken tree of modules. "foo" is
orphan
Findbugs plugin 3.4.4 from https://github.com/SonarQubeCommunity/sonar-findbugs/releases (as hinted in API incompatibility with SonarQube 5.6 and Java Analyzer 4.0 with Findbugs 3.3 or Cobertura 1.6.3) --> same error
DEBUG LOGGING
Maven with -e and -X
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project root: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource; -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project root: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
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.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:132)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 31 more
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.sonar.plugins.clirr.ClirrSensor.saveIssues(ClirrSensor.java:94)
at org.sonar.plugins.clirr.ClirrSensor.analyse(ClirrSensor.java:76)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:184)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:78)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
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.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135)
... 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
QUESTION
Is this a configuration issue at my end? Or is there an issue with SonarQube or any of the plugins?
I will also accept answers that let me exclude the codeless root module as a workaround, without any interference for the child modules that have it as a parent.
The lines that might have raised your attention are the following ones:
Caused by: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaResourceLocator.findResourceByClassName(Ljava/lang/String;)Lorg/sonar/api/resources/Resource;
at org.sonar.plugins.clirr.ClirrSensor.saveIssues(ClirrSensor.java:94)
You must uninstall the Clirr plugin: it is not compatible with SonarQube 6.0.
To be honest, maybe this is not exactly the solution to your problem. But let me describe where I ran into a similar problem that matches your following description:
Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. "foo" is orphan.
I had changed my maven build to ci friendly as described by maven here.
Generally, my maven build was running fine until I added sonarqube check. Then I got the above-described message. It took a while to finde the problem and it was quite tricky.
By the way, I had a multiple module maven project running and the problem was that in my parent pom I was referring to the pom.xml instead of the folder.
<modules>
<module>modules/module1</module>
<!-- the reference to the pom.xml is the problem.
and will cause sonar to fail -->
<module>modules/module2/pom.xml</module>
</modules>
Related
We have a microservices project which was running (in Karaf) and building with JDK 8.
Now I am trying to build it with JDK 11 (OpenJDK in fact) but I am getting this error.
Does that mean this plugin is not compatible with JDK 11?
Or does it mean something else?
On the official page of the plugin I do not see any info if the plugin is compatible with JDK 11. The plugin latest version seems to be 1.10.0 and that's the one I am trying to use (but that was last build in 2018 so was it replaced with something else?).
[ERROR] Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.10.0:blueprint-generate (default) on project microservices: Error during blueprint generation: IllegalArgumentException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.10.0:blueprint-generate (default) on project microservices: Error during blueprint generation
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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: Error during blueprint generation
at org.apache.aries.blueprint.plugin.GenerateMojo.execute(GenerateMojo.java:149)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.IllegalArgumentException
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:580)
at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:576)
at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:562)
at org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:122)
at org.apache.aries.blueprint.plugin.GenerateMojo.createProjectScopeFinder(GenerateMojo.java:220)
at org.apache.aries.blueprint.plugin.GenerateMojo.generateBlueprint(GenerateMojo.java:155)
at org.apache.aries.blueprint.plugin.GenerateMojo.execute(GenerateMojo.java:145)
... 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
I've just falled into several similar issues with blueprint-maven-plugin when migrating karaf-deployed projects from jdk8 to jdk11. As the blueprint-maven-plugin is still at version 1.10.0 since May 2018, following discussion within these issues
https://issues.apache.org/jira/browse/ARIES-1826
Blueprint maven plugin RuntimeException
https://issues.apache.org/jira/browse/ARIES-1596
i have a workaround by overriding version of org.apache.xbean:xbean-finder-shaded to the latest version for the blueprint-maven-plugin:
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>blueprint-maven-plugin</artifactId>
<version>1.10.0</version>
<dependencies>
<dependency>
<groupId>org.apache.xbean</groupId>
<artifactId>xbean-finder-shaded</artifactId>
<version>4.20</version>
</dependency>
</dependencies>
</plugin>
I have a webapp that I try to compile using maven, unfortunatly it is not working when doing mvn clean package. There is a LOT of questions on stackoverflow that seems the same but none solved my issue.
I doubled checked if version of Java is the same (set to 1.7) for JAVA_HOME + target and source of Maven compile plugin. It is.
I tried upgrading and downgrading maven compile plugin without success.
Unfortunatly, it is not possible to put my pom.xml here as it is +1500 lines long.
This error occured after I added a new maven module (that has firebase as a dependency) to my produit-webapp. This module compiled fine.
The error output I get from running it with the full debug logging:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project produit-webapp: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project produit-webapp: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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: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.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:862)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
You might want to look into the dependencies of your webapp (in pom.xml). You stated that your pom.xml is very long, I'm guessing it was working before with other modules and you added a new module.
If so, you should try remove the dependency to the new module. If it's compiling fine then, at least, you know where it comes from.
To do further investigation, add back the new module in your webapp and then remove dependencies inside the new module. Add back one by one the dependencies to find the one that is causing the problem.
Once you found the culprit dependency, see what are the dependencies of this dependency (ctrl + left click on the dependency in Eclipse to open the related pom.xml) and do the same as previously : remove dependencies and add them back to find what is causing the problem.
How to properly remove dependencies :
You should use the <exclusion> tag and not just comment out dependency, see this page on how to do so.
If you have a lot of dependencies, it can be long do exclude module one by one, so you can do it faster by removing half of it and see if it's compiling. If it's not compiling then it means the culprit dependency is inside the other half. Try with the other half which should compile. Repeat with half of this part until you find the responsible (kinda like in a binary search)
This solution is recommend only to find where the issue comes from. It removes the error when compiling but your webapp mights throw an error on runtime as it needs the dependency you removed !
I recently upgraded to the newest SonarQube 5.1, but now, my maven builds have begun failing and I'm unable to determine what file is causing the error. The maven project is a multi module project.
SonarQube version 5.1
maven goal executed with "mvn sonar:sonar" (version 2.6 is used and the correctly analyses some of the projects)
The maven build finishes with the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project flex-parentpom: null: MojoExecutionException: StackOverflowError -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project flex-parentpom: null
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:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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: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
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:132)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.StackOverflowError
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBinaryExpression(BaseTreeVisitor.java:208)
at org.sonar.java.model.expression.BinaryExpressionTreeImpl.accept(BinaryExpressionTreeImpl.java:85)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42)
at org.sonar.java.resolve.SemanticModel$1.scan(SemanticModel.java:92)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBinaryExpression(BaseTreeVisitor.java:208)
at org.sonar.java.model.expression.BinaryExpressionTreeImpl.accept(BinaryExpressionTreeImpl.java:85)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42)
at org.sonar.java.resolve.SemanticModel$1.scan(SemanticModel.java:92)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBinaryExpression(BaseTreeVisitor.java:208)
at org.sonar.java.model.expression.BinaryExpressionTreeImpl.accept(BinaryExpressionTreeImpl.java:85)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42)
at org.sonar.java.resolve.SemanticModel$1.scan(SemanticModel.java:92)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitBinaryExpression(BaseTreeVisitor.java:208)
at org.sonar.java.model.expression.BinaryExpressionTreeImpl.accept(BinaryExpressionTreeImpl.java:85)
at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42)
at org.sonar.java.resolve.SemanticModel$1.scan(SemanticModel.java:92)
Any ideas for debugging the cause of the error? I've attempted with -debug flag.
Problem solved.
I ended up setting up a local instance and running the maven plugin using a debugger, this allowed me to set a breakpoint at the exception. I turned out that we had a test case (file) which had a field defined by hundreds of Strings. This file has not been edited for a long time, so I guess the overall stack size has changed from 4.x to 5.x. The test was ugly and my solution in this case was therefore to refactor it. I guess another solution would be to increase the java stack size, but I've not tried it.
I'm trying to build pljava sources on Linux Mint 17 Qiana (32bit) with maven 3.2.5, JDK 1.7.0_72-b14, gpp is installed (2.24) and all modules are compiled fine except one: pl/java server side library.
The stacktrace is:
[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile (default-nar-compile) on project pljava-so: Execution default-nar-compile of goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile failed. NullPointerException -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile (default-nar-compile) on project pljava-so: Execution default-nar-compile of goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
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:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
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: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.PluginExecutionException: Execution default-nar-compile of goal com.github.maven-nar:nar-maven-plugin:3.1.0:nar-compile failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 moreCaused by: java.lang.NullPointerException
at com.github.maven_nar.cpptasks.gcc.GppLinker.isClang(GppLinker.java:317)
at com.github.maven_nar.cpptasks.gcc.GppLinker.addImpliedArgs(GppLinker.java:159)
at com.github.maven_nar.cpptasks.compiler.CommandLineLinker.createConfiguration(CommandLineLinker.java:153)
at com.github.maven_nar.cpptasks.compiler.AbstractLinker.createConfiguration(AbstractLinker.java:83)
at com.github.maven_nar.cpptasks.ProcessorDef.createConfiguration(ProcessorDef.java:200)
at com.github.maven_nar.cpptasks.CCTask.collectExplicitObjectFiles(CCTask.java:500)
at com.github.maven_nar.cpptasks.CCTask.execute(CCTask.java:647)
at com.github.maven_nar.NarCompileMojo.createLibrary(NarCompileMojo.java:433)
at com.github.maven_nar.NarCompileMojo.narExecute(NarCompileMojo.java:107)
at com.github.maven_nar.AbstractNarMojo.execute(AbstractNarMojo.java:329)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 20 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:
How can I fix this?
In my case (Debian) this problem has been solved by installing the g++ package.
I have found this workaround here.
Quote:
I tracked the problem in GppLinker.isClang which is trying to invoke "g++ --version". Since this is a new VM, I was still in the process of determining what needed to be installed. In this case, I hadn't yet installed the gcc-c++ package to get g++.
Note: The sources I was compiling have been checked out at 2015-04-01.
I updated SonarQube to 4.2 and it is not working at Jenkins now. T.T
Jenkins and SonarQube are installed in same server and I'm using mysql.
also, Jenkins setting for SonarQube is pointing the mysql db.
... and Maven version in Jenkins is 3.0.5
I don't set the sonar maven plugin in the java project.
It worked fine with Sonar 3.4.1 and I didn't change any setting on Jenkins after update the SonarQube.
here is error trace.
[ERROR] Expected one result (or null) to be returned by selectOne(), but found: 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.495s
[INFO] Finished at: Tue Apr 15 06:10:08 GMT 2014
[INFO] Final Memory: 20M/89M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project java-utils: Can not execute SonarQube analysis: Expected one result (or null) to be returned by selectOne(), but found: 2 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project java-utils: 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: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: Can not execute SonarQube analysis
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:109)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:67)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:109)
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: org.apache.maven.plugin.MojoExecutionException: Expected one result (or null) to be returned by selectOne(), but found: 2
at org.sonar.maven.ExceptionHandling.handle(ExceptionHandling.java:37)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:175)
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:104)
... 23 more`enter code here`
Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:66)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
at com.sun.proxy.$Proxy61.selectByNameAndLanguage(Unknown Source)
at org.sonar.core.qualityprofile.db.QualityProfileDao.selectByNameAndLanguage(QualityProfileDao.java:181)
at org.sonar.core.qualityprofile.db.QualityProfileDao.selectByNameAndLanguage(QualityProfileDao.java:188)
at org.sonar.batch.rule.ModuleQProfiles.loadQProfile(ModuleQProfiles.java:105)
at org.sonar.batch.rule.ModuleQProfiles.(ModuleQProfiles.java:92)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61)
at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100)
at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:112)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1033)
at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1025)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
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:144)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
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.IsolatedLauncher.execute(IsolatedLauncher.java:45)
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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
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:90)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:173)
... 24 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
You're facing http://jira.codehaus.org/browse/SONAR-5196 that is fixed in the upcoming version (4.3). It means that you have two identical quality profiles (same name but different case) for the same language. Could you delete one and run again an analysis?
Maybe you did not update your SonarQube database. To do this start your SonarQube like
http://<sonarqubeserver>/setup
and follow the instructions there.
This update is sometimes necessary if the upgrade introduces database changes. Nevertheless SonarQube should post a maintenance message if you start it in your browser.
I was the exact same issue. I was 2 quality profiles with the same exact name (after upgrading sonar from 3.5 to 4.2).
I remove the old "sonar way" and keep the new "sonar way" quality profile and it worked.
Thanks for your answers.
I found bunch of "Sonar way" profiles for each language profiles, in actually, I focussed on JAVA profile only.
I renamed all the profiles.
like,
Groovy-Sonar way (from Sonar way for Groovy profiles)
Java-Sonar way (from Sonar way for Java profiles)
JavaScript-Sonar way (from Sonar way for JavaScript profiles)
PHP-Sonar Way (from Sonar way for PHP profiles)
But PHP profiles had "Sonar way" and "Sonar Way". I removed one of them.
and anyway, running Sonar from Jenkins has worked successfully now!
Thank you.
Delete your project that is causing the error in the SonarQube web-interface and then re-scan the project.