Sonar

Compatibility with Maven 3.0

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.2
  • Component/s: Maven Plugin
  • Labels:
    None
  • Number of attachments :
    0

Description

Executing Sonar with Maven 3.0-alpha-3 fails with the following error :

[ERROR] Can not execute Sonar: UnsupportedOperationException -> [Help 1]
org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
	at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
	at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
	at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:547)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:317)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:239)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:421)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:156)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:592)
	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: java.lang.UnsupportedOperationException
	at org.apache.maven.plugin.internal.DefaultPluginManager.executeMojo(DefaultPluginManager.java:107)
	at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
	... 18 more

Issue Links

Activity

Hide
Olivier Lamy added a comment -

work in progress rev 11395.
but npe in pico

Caused by: java.lang.NullPointerException
        at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:441)
        at org.picocontainer.DefaultPicoContainer.access$400(DefaultPicoContainer.java:78)
        at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1023)
        at org.sonar.batch.BatchMojo.createMainContainer(BatchMojo.java:157)
        at org.sonar.batch.BatchMojo.executeBatch(BatchMojo.java:135)
        at org.sonar.batch.BatchMojo.execute(BatchMojo.java:130)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)

code in branh https://svn.codehaus.org/mojo/branches/sonar-maven-plugin-mvn-3.x

Show
Olivier Lamy added a comment - work in progress rev 11395. but npe in pico
Caused by: java.lang.NullPointerException
        at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:441)
        at org.picocontainer.DefaultPicoContainer.access$400(DefaultPicoContainer.java:78)
        at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1023)
        at org.sonar.batch.BatchMojo.createMainContainer(BatchMojo.java:157)
        at org.sonar.batch.BatchMojo.executeBatch(BatchMojo.java:135)
        at org.sonar.batch.BatchMojo.execute(BatchMojo.java:130)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)
code in branh https://svn.codehaus.org/mojo/branches/sonar-maven-plugin-mvn-3.x
Hide
Simon Brandhof added a comment -

The mojo is just a bootstrapper. It installs and executes the sonar-core-maven-plugin, deployed into the sonar server.
This one has to be upgraded to Maven 3 too, because it executes other maven plugins like checkstyle or cobertura. In order to be compatible with both maven 2.x and 3.x versions, I think we should :

  • extract all core classes of sonar-core-maven-plugin in a new module called sonar-batch.
  • create a sonar-core-maven3-plugin, depending on sonar-batch.

Both sonar-core-maven-plugin and sonar-core-maven3-plugin are deployed when starting sonar. The first one is executed by the current version of the sonar mojo (1.0-beta-1), the second one by the version 2.0.

Not sure I've been understandable !

Show
Simon Brandhof added a comment - The mojo is just a bootstrapper. It installs and executes the sonar-core-maven-plugin, deployed into the sonar server. This one has to be upgraded to Maven 3 too, because it executes other maven plugins like checkstyle or cobertura. In order to be compatible with both maven 2.x and 3.x versions, I think we should :
  • extract all core classes of sonar-core-maven-plugin in a new module called sonar-batch.
  • create a sonar-core-maven3-plugin, depending on sonar-batch.
Both sonar-core-maven-plugin and sonar-core-maven3-plugin are deployed when starting sonar. The first one is executed by the current version of the sonar mojo (1.0-beta-1), the second one by the version 2.0. Not sure I've been understandable !
Hide
Simon Brandhof added a comment -

I come back to you when the modifications described in the previous comment are done.

Show
Simon Brandhof added a comment - I come back to you when the modifications described in the previous comment are done.
Hide
Simon Brandhof added a comment -

Olivier Lamy fixed an issue with maven 3 classloader. We're waiting now for the release of maven-checkstyle-plugin 2.5 (see MCHECKSTYLE-123)

Show
Simon Brandhof added a comment - Olivier Lamy fixed an issue with maven 3 classloader. We're waiting now for the release of maven-checkstyle-plugin 2.5 (see MCHECKSTYLE-123)
Hide
Olivier Lamy added a comment -

sure I will try to cut this release ASAP.

Show
Olivier Lamy added a comment - sure I will try to cut this release ASAP.
Hide
Simon Brandhof added a comment -

Thank you, it's done.

Show
Simon Brandhof added a comment - Thank you, it's done.
Hide
Robert Wetzold added a comment -

It is great to see activity here! Is there actually a roadmap on when full Maven 3 support will be available? How far are you along the road? What are the big issues currently?

Show
Robert Wetzold added a comment - It is great to see activity here! Is there actually a roadmap on when full Maven 3 support will be available? How far are you along the road? What are the big issues currently?
Hide
Simon Brandhof added a comment -

We still have an issue with custom checkstyle rules. I'm not sure we'll have enough time to fix it for release 2.0 but for 2.1.

Show
Simon Brandhof added a comment - We still have an issue with custom checkstyle rules. I'm not sure we'll have enough time to fix it for release 2.0 but for 2.1.
Hide
Evgeny Mandrikov added a comment -

Just FYI: I'm working with sonar-maven-plugin from branch about a week and it works fine. But of course I don't use custom rules.

Show
Evgeny Mandrikov added a comment - Just FYI: I'm working with sonar-maven-plugin from branch about a week and it works fine. But of course I don't use custom rules.
Hide
Olivier Lamy added a comment -

is it due to an issue in checkstyle plugin ?

Show
Olivier Lamy added a comment - is it due to an issue in checkstyle plugin ?
Hide
Simon Brandhof added a comment -

No, the problem comes from the way Sonar adds dependencies to maven plugins at runtime.
The configuration of maven plugins (including version to use, parameters and additional dependencies) is added at runtime to the current maven session. It works well in major cases, except for additional deps when the target plugin is already defined in the initial pom.

Show
Simon Brandhof added a comment - No, the problem comes from the way Sonar adds dependencies to maven plugins at runtime. The configuration of maven plugins (including version to use, parameters and additional dependencies) is added at runtime to the current maven session. It works well in major cases, except for additional deps when the target plugin is already defined in the initial pom.
Hide
Nikolay Nikolov added a comment -

Is the last version available somewhere as a binary?

Show
Nikolay Nikolov added a comment - Is the last version available somewhere as a binary?
Hide
Evgeny Mandrikov added a comment -

For now not.

Show
Evgeny Mandrikov added a comment - For now not.
Hide
Simon Brandhof added a comment -

The Sonar maven plugin hosted at Codehaus Mojo is still not compatible with Maven 3. To benefit from this feature, build the trunk and execute

mvn org.codehaus.sonar:sonar-maven3-plugin:2.2-SNAPSHOT:sonar

Show
Simon Brandhof added a comment - The Sonar maven plugin hosted at Codehaus Mojo is still not compatible with Maven 3. To benefit from this feature, build the trunk and execute
mvn org.codehaus.sonar:sonar-maven3-plugin:2.2-SNAPSHOT:sonar
Hide
Simon Brandhof added a comment -

For information it supports maven 3.0-beta-1 but not alpha versions.

Show
Simon Brandhof added a comment - For information it supports maven 3.0-beta-1 but not alpha versions.
Hide
Freddy Mallet added a comment -

Dependencies between Maven modules are lost in the 'Design' service when analyzing Maven multi-modules project with Maven 3 and Sonar 2.2. But the content of the 'Libraries' service is correct.

Show
Freddy Mallet added a comment - Dependencies between Maven modules are lost in the 'Design' service when analyzing Maven multi-modules project with Maven 3 and Sonar 2.2. But the content of the 'Libraries' service is correct.
Hide
Simon Brandhof added a comment -

The Codehaus Mojo is not updated, so the shortcut mvn sonar:sonar still does not work. The temporary workaround is to execute this command-line for maven 3 : mvn org.codehaus.sonar:sonar-maven3-plugin:2.2:sonar

Show
Simon Brandhof added a comment - The Codehaus Mojo is not updated, so the shortcut mvn sonar:sonar still does not work. The temporary workaround is to execute this command-line for maven 3 : mvn org.codehaus.sonar:sonar-maven3-plugin:2.2:sonar
Hide
Linda Cooper added a comment -

I am seeing this same error with Maven 3.0 Beta.

Show
Linda Cooper added a comment - I am seeing this same error with Maven 3.0 Beta.
Hide
Freddy Mallet added a comment -

I do confirm that the following command line works with maven 3-beta3 :

mvn org.codehaus.sonar:sonar-maven3-plugin:2.2:sonar

To be able to launch the standard command "mvn sonar:sonar", the ticket MOJO-1545 needs to be fixed.

Show
Freddy Mallet added a comment - I do confirm that the following command line works with maven 3-beta3 :
mvn org.codehaus.sonar:sonar-maven3-plugin:2.2:sonar
To be able to launch the standard command "mvn sonar:sonar", the ticket MOJO-1545 needs to be fixed.
Hide
Vincent Massol added a comment -

Hi,

I'm getting this exact same error. I'm on Sonar 2.2 and Maven 3.0 final. Anything I should do/check? Thanks

Show
Vincent Massol added a comment - Hi, I'm getting this exact same error. I'm on Sonar 2.2 and Maven 3.0 final. Anything I should do/check? Thanks
Hide
Evgeny Mandrikov added a comment -

You should use org.codehaus.sonar:sonar-maven3-plugin instead of org.codehaus.mojo:sonar-maven-plugin or see SONAR-1851.

Show
Evgeny Mandrikov added a comment - You should use org.codehaus.sonar:sonar-maven3-plugin instead of org.codehaus.mojo:sonar-maven-plugin or see SONAR-1851.
Hide
Vincent Massol added a comment -

Thanks Evgeny

Show
Vincent Massol added a comment - Thanks Evgeny

People

Vote (19)
Watch (13)

Dates

  • Created:
    Updated:
    Resolved: