tags:

views:

142

answers:

2

Hello,

I try to execute the mvn sonar:sonar command on a machine where Maven is configured to have no access to external repositories (in reality, this is not exactly the case, but it helps me to explain my problem).

So currently, if I run this command, I get the following error:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.codehaus.mojo:sonar-maven-plugin' does not exist or no valid version could be found

I think it means that I have some incorrect metadata in my local repository, as I have a [local repo]\org\codehaus\mojo\sonar-maven-plugin\1.0-beta-1 directory (with the JAR inside, of course).

Have you any idea why my command is failing?

tech infos: Maven 2.2.1, Java 1.6, Sonar 2.1.2

A: 

Did you try the suggestions from the FAQ:

The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found

If you get this error message after launching the maven command line "mvn sonar:sonar" add the "-U" parameter to the command line. Maven will then update its local repository with the latest version of the Sonar Maven plugin.

If adding the "-U" parameter doesn't fix your issue, you've certainly encountered Maven bug MNG-4001. The only known workaround is to delete the org\codehaus\mojo directory in your local Maven repository. Of course, if your local Maven repository is synchronized with a repository manager like Nexus, this operation must be also done on the repository manager side.

Pascal Thivent
yes, of course :)
romaintaz
@romaintaz Then you should mention it in your question. Mentioning what you already tried will: 1. save time for readers 2. avoid getting useless answers.
Pascal Thivent
A: 

My problem is resolved now since it was mainly a problem of maven metadata file.

The org/codehaus/mojo/sonar-maven-plugin did not contains the correct maven-metadata.xml file. Thus, Maven 2 was unable to know which version of the plugin was needed. Adding it resolved my issue.

romaintaz