sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

Xavier
This post has NOT been accepted by the mailing list yet.
Hi,

with Java plugin 2.6 and SonarQube 4.5.1, in a Maven module without Java sources (for instance a module with the element <packaging>pom</packaging> inside its pom.xml) I have the following exception (see below).
It looks like http://jira.codehaus.org/browse/SONARJAVA-759 introduced this behavior.
But I think a Maven module with a POM packaging should not be analysed by SonarQube as it does not contain source code by definition.
The problem also exists with Maven modules that only contain integration tests and no source code in src/main/java.
Let me know if I can create a Jira ticket.

Cheers,
Xavier

[INFO] [16:59:15.111] Load module settings
[ERROR] [16:59:15.159] Invalid value for sonar.binaries
[ERROR] No files nor directories matching '/app/jenkins-slave/workspace/myProject/myModule/target/classes'
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: No files nor directories matching '/app/jenkins-slave/workspace/myProject/myModule/target/classes'
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.apache.maven.plugin.MojoExecutionException: No files nor directories matching '/app/jenkins-slave/workspace/myProject/myModule/target/classes'
        at org.sonar.maven.ExceptionHandling.handle(ExceptionHandling.java:37)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:175)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
        ... 21 more
Caused by: java.lang.IllegalStateException: No files nor directories matching '/app/jenkins-slave/workspace/myProject/myModule/target/classes'
        at org.sonar.java.JavaClasspath.getFilesFromProperty(JavaClasspath.java:120)
        at org.sonar.java.JavaClasspath.<init>(JavaClasspath.java:73)
        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.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.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:233)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
        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:64)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
        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:173)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
        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:100)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:173)
        ... 23 more
Reply | Threaded
Open this post in threaded view
|

Re: sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

Xavier
This post has NOT been accepted by the mailing list yet.
Answering to myself: this bug only occurs on Maven 2 projects. Upgrading them to Maven 3 solves the problem.

Cheers,
Xavier
Reply | Threaded
Open this post in threaded view
|

Re: sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

Malli
Actually I had the same issue on my side so I basically reverted the upgrade to Java plugin 2.5.1.

I would be interested to know what you meant by "migrating to Maven 3" as we're already using Maven 3 on our side.
Reply | Threaded
Open this post in threaded view
|

Re: sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

zoltanmaric
Malli wrote
Actually I had the same issue on my side so I basically reverted the upgrade to Java plugin 2.5.1.

I would be interested to know what you meant by "migrating to Maven 3" as we're already using Maven 3 on our side.
We're using Maven 2 and currently upgrading to Maven 3 is not an option. Downgrading the Java plugin to 2.5.1 fixed the issue. Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: sonar.binaries error when no Java sources in Java plugin 2.6 with a Maven project

Nicolas Peru
Hi, 


Cheers,

Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com


On 2 February 2015 at 11:29, zoltanmaric <[hidden email]> wrote:
Malli wrote
> Actually I had the same issue on my side so I basically reverted the
> upgrade to Java plugin 2.5.1.
>
> I would be interested to know what you meant by "migrating to Maven 3" as
> we're already using Maven 3 on our side.

We're using Maven 2 and currently upgrading to Maven 3 is not an option.
Downgrading the Java plugin to 2.5.1 fixed the issue. Thanks!



--
View this message in context: http://sonarqube.15.x6.nabble.com/sonar-binaries-error-when-no-Java-sources-in-Java-plugin-2-6-with-a-Maven-project-tp5030221p5032111.html
Sent from the SonarQube Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email