Discussion:
[sonar-user] mvn sonar:sonar
Peter Horlock
2009-09-02 12:05:54 UTC
Permalink
Hi,

I am using hte maven sonar plugin and recently updated to the 1.10.1
server version.
Since then I got:
[exec] [INFO] Sonar plugin (1.7) and server (1.10.1) version do not
matchExclusionPattern.
[exec] Either update your server to the 1.7 plugin version or launch

[exec] the mvn org.codehaus.sonar:sonar-maven-plugin:1.10.1:sonar
plugin command.

As far as I know org.codehaus.sonar:sonar-maven-plugin:1.10.1 doesn't exist yet.
The newest version I found was 1.8.


Using version 1.8, I however get:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: Unable to build project for plugin
'org.codehaus.sonar.runtime:sonar-core-maven-plugin': POM
'org.codehaus.sonar.runtime:sonar-core-maven-plugin' not found in
repository: Unable to download the artifact from any repository


org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317


How can I fix that?

Thanks in advance,


Peter
Freddy Mallet
2009-09-02 12:51:28 UTC
Permalink
Hi Peter,

I do confirm that Sonar 1.10.1 is the lastest version and each version
update both the server side and maven plugin side. So if you use Sonar web
server 1.10.1 you must use Sonar Maven plugin 1.10.1.

Hope it helps,
Freddy

On Wed, Sep 2, 2009 at 2:05 PM, Peter Horlock
Hi,
I am using hte maven sonar plugin and recently updated to the 1.10.1 server version.
[exec] [INFO] Sonar plugin (1.7) and server (1.10.1) version do not matchExclusionPattern.
[exec] Either update your server to the 1.7 plugin version or launch
[exec] the mvn org.codehaus.sonar:sonar-maven-plugin:1.10.1:sonar plugin command.
As far as I know org.codehaus.sonar:sonar-maven-plugin:1.10.1 doesn't exist yet.
The newest version I found was 1.8.
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin': POM 'org.codehaus.sonar.runtime:sonar-core-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317
How can I fix that?
Thanks in advance,
Peter
Peter Horlock
2009-09-02 19:30:22 UTC
Permalink
Hi Freddy,

thanks for your reply. I really can't find maven plugin version 1.10.1 - I
searched everywhere - the only place I didn't look yet-
was in the the server zip file itself - the server is installed by our
admin, the client by me, so I haven't really touched the server files yet.
Just downloading the file, let's see if'll find it. Maybe putting the plugin
in a separate location would be a better idea.

P.s.: Sonar ownz BIG TIME! Keep it up!!!!
I just joined a new company. and improved a legacy project of 60.000 Lines
from 0 to 97% rule compliances, still improving...... :-)

P.p.s.: Something has happend with the line counting - in version 1.7 it
said ~30k lines now it says ~60k

Cheers,

Peter
Freddy Mallet
2009-09-02 20:07:09 UTC
Permalink
Oups Peter, the content of my last email was not correct. Sorry for that.

Looks like you're migrating from version 1.7 to version 1.10.1. There was a
big change in Sonar 1.8 on the way the Sonar Maven plugin work. Have a look
to the following blog entry to understand the change [1].

Since Sonar 1.8, you just have to call "mvn sonar:sonar" and you don't have
to specify any Sonar version (There is in fact a kind of bootstrap
mechanism). I guess you still try to call the old command "mvn
org.codehaus.sonar:sonar-maven-goal:X.Y:sonar" which is no more supported.

For information, the bootstrap mechanism is hosted by the Codehaus Mojo
project, is in version 1.0-beta-1 and is available on all maven public
repositories [2] but you don't have to worry about that. The first time you
call mvn sonar:sonar, you can add the "-U" property to be sure that Maven
will try to find the Sonar Maven plugin on public repositories.

If you want to understand why your measures have changed between Sonar 1.7
and Sonar 1.10, have a look to the following blog entry [3]. This change has
a name : Sonar Squid !

Hope it helps,
Freddy

[1] - http://sonar.codehaus.org/we-had-a-dream-mvn-sonarsonar/
[2] - http://repo1.maven.org/maven2/org/codehaus/mojo/sonar-maven-plugin/
[3] - http://sonar.codehaus.org/why-you-should-not-upgrad-to-sonar-19/

On Wed, Sep 2, 2009 at 9:30 PM, Peter Horlock
Post by Peter Horlock
Hi Freddy,
thanks for your reply. I really can't find maven plugin version 1.10.1 - I
searched everywhere - the only place I didn't look yet-
was in the the server zip file itself - the server is installed by our
admin, the client by me, so I haven't really touched the server files yet.
Just downloading the file, let's see if'll find it. Maybe putting the
plugin in a separate location would be a better idea.
P.s.: Sonar ownz BIG TIME! Keep it up!!!!
I just joined a new company. and improved a legacy project of 60.000 Lines
from 0 to 97% rule compliances, still improving...... :-)
P.p.s.: Something has happend with the line counting - in version 1.7 it
said ~30k lines now it says ~60k
Cheers,
Peter
Peter Horlock
2009-09-02 20:51:05 UTC
Permalink
Post by Freddy Mallet
mechanism). I guess you still try to call the old command "mvn
org.codehaus.sonar:sonar-maven-goal:X.Y:sonar" which is no more supported.
Yeah. Sonar 1.7 was set up by someone else before I joined the project. Now
all I did was
going from:
http://repo1.maven.org/maven2/org/codehaus/sonar/sonar-maven-plugin/1.7/
to
http://repo1.maven.org/maven2/org/codehaus/sonar/sonar-maven-plugin/1.8/

cause that was the last version I found under that path.

Okay, now that I looked for sonar/sonar, I found:
http://repo1.maven.org/maven2/org/codehaus/sonar/sonar/1.10.1/

Will try that tomorrow morning! :-)

(10:50pm here)

Did I mention Sonar rules? I love statistics! :-P


Cheers,

Peter
Peter Horlock
2009-09-03 10:26:05 UTC
Permalink
Hi Freddy,

unfortunately, it still doesn't work! :-(
Here's what I get:

***@mymachine:~/workspace/myProject/$ mvn sonar:sonar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO]
------------------------------------------------------------------------
[INFO] Building myProject
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO]
------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://192.168.1.1:8080/sonar
[INFO] Sonar version: 1.10.1
Downloading:
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository sonar (http://192.168.1.1:8080/sonar/deploy/maven)
Downloading:
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository central (http://repo1.maven.org/maven2)
Downloading:
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository sonar (http://192.168.1.1:8080/sonar/deploy/maven)
Downloading:
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository mycompanyinternal (
http://192.168.1.1:8080/nexus/content/groups/internal/)
Downloading:
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository central (http://repo1.maven.org/maven2)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: Unable to build project for plugin
'org.codehaus.sonar.runtime:sonar-core-maven-plugin': POM
'org.codehaus.sonar.runtime:sonar-core-maven-plugin' not found in
repository: Unable to download the artifact from any repository

org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317

from the specified remote repositories:
mycompanyinternal (http://192.168.1.1:8080/nexus/content/groups/internal/)

for project org.codehaus.sonar.runtime:sonar-core-maven-plugin
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second

I even added this to my parent pom:
[...]
<pluginManagement>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
<version>1.10.1</version>
</plugin>
</plugins>
</pluginManagement>
[...]

However that didn't help much either :-(

Any ideas?

Thanks in advance,

Peter
Freddy Mallet
2009-09-03 19:18:31 UTC
Permalink
Hi Peter,

Looks like, you have a mirror defined in your settings.xml file which
forwards all requests to your internal Nexus repository. Sonar web server
embeds its own maven repository which is used by the Sonar maven plugin to
download all Sonar plugins and extensions like pmd, checkstyle, findbugs,
etc. You need to slightly change the configuration of your mirror in order
to be able to use Sonar :

http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-Mavenmirrors%3Athemavenpluginfailstoresolveorg.codehaus.sonar.runtime
.\dependencies

Freddy
Post by Peter Horlock
Hi Freddy,
unfortunately, it still doesn't work! :-(
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO]
------------------------------------------------------------------------
[INFO] Building myProject
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO]
------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://192.168.1.1:8080/sonar
[INFO] Sonar version: 1.10.1
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository sonar (http://192.168.1.1:8080/sonar/deploy/maven)
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository central (http://repo1.maven.org/maven2)
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository sonar (http://192.168.1.1:8080/sonar/deploy/maven)
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository mycompanyinternal (
http://192.168.1.1:8080/nexus/content/groups/internal/)
http://192.168.1.1:8080/nexus/content/groups/internal//org/codehaus/sonar/runtime/sonar-core-maven-plugin/20090826155317/sonar-core-maven-plugin-20090826155317.pom
[INFO] Unable to find resource
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317' in
repository central (http://repo1.maven.org/maven2)
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin
'org.codehaus.sonar.runtime:sonar-core-maven-plugin': POM
'org.codehaus.sonar.runtime:sonar-core-maven-plugin' not found in
repository: Unable to download the artifact from any repository
org.codehaus.sonar.runtime:sonar-core-maven-plugin:pom:20090826155317
mycompanyinternal (
http://192.168.1.1:8080/nexus/content/groups/internal/)
for project org.codehaus.sonar.runtime:sonar-core-maven-plugin
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1 second
[...]
<pluginManagement>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
<version>1.10.1</version>
</plugin>
</plugins>
</pluginManagement>
[...]
However that didn't help much either :-(
Any ideas?
Thanks in advance,
Peter
Peter Horlock
2009-09-04 09:57:32 UTC
Permalink
Hi Freddy,

Thanks for your reply.

I think we're getting closer! ;-)

Now I am getting:

[exec] [INFO]
------------------------------------------------------------------------
[exec] [ERROR] BUILD ERROR
[exec] [INFO]
------------------------------------------------------------------------
[exec] [INFO] Can not execute Sonar
[exec]
[exec] Embedded error: Unable to execute maven plugin
[exec] Compilation failure

---------

BTW - we are starting sonar by a job from Hudson, so it's all on a
remote machine. Maybe hudson needs more rights on the machine, or
something???

Thanks in advance,

Peter
Freddy Mallet
2009-09-04 11:31:17 UTC
Permalink
Hi Peter,

Looks like your project doesn't currently compile and this compilation is
mandatory to execute unit tests and analyze bytecode. Could you configure
your Hudson job to launch "mvn clean install" before executing the Sonar
Maven plugin ? If my understanding is correct the "install" phase will fail.

regards
Freddy
Post by Peter Horlock
Hi Freddy,
Thanks for your reply.
I think we're getting closer! ;-)
[exec] [INFO] ------------------------------------------------------------------------
[exec] [ERROR] BUILD ERROR
[exec] [INFO] ------------------------------------------------------------------------
[exec] [INFO] Can not execute Sonar
[exec]
[exec] Embedded error: Unable to execute maven plugin
[exec] Compilation failure
---------
BTW - we are starting sonar by a job from Hudson, so it's all on a remote machine. Maybe hudson needs more rights on the machine, or something???
Thanks in advance,
Peter
Peter Horlock
2009-09-04 14:03:17 UTC
Permalink
Hmm - yes - and no.

We are still having a mixture of Ant and Maven.

The last lines, before the error occurs, are:
exec] [INFO] Building Project
[exec] [INFO] task-segment:
[org.codehaus.mojo:cobertura-maven-plugin:2.3:cobertura]
[exec] [INFO]
------------------------------------------------------------------------
[exec] [INFO] Preparing cobertura:cobertura
[exec] [INFO] [build-helper:add-source {execution: default}]
[exec] [INFO] Source directory:
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/build.maven/generated-src
added.
[exec] [INFO] [resources:resources]
[exec] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[exec] [INFO] skip non existing resourceDirectory
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/src/main/resources
[exec] [INFO] [compiler:compile]
[exec] [INFO] Compiling 46 source files to
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/build.maven/classes
[exec] [INFO]
------------------------------------------------------------------------
[exec] [ERROR] BUILD ERROR
[exec] [INFO]
------------------------------------------------------------------------
[exec] [INFO] Can not execute Sonar
[exec]
[exec] Embedded error: Unable to execute maven plugin
[exec] Compilation failure

----------------------------------------
it's so that we do have written an ant target, besides other stuff it auto
creates source code based on xml files.
The ant task knows where to find those files and handles everything
correctly. However,
calling a "mvn clean install" fails on that project. Well, to be honest, I
don't know too much about the entire process, cause
it was defined by someone else. However, what I do know is - all that was
working with sonar 1.1.7, so it should still be working
in 1.1.10.1, right???

Thanks in advance,

Peter
Freddy Mallet
2009-09-05 06:50:06 UTC
Permalink
Hi Peter,

The following documentation describes how to make Sonar working with
non-maven project :

http://docs.codehaus.org/display/SONAR/Analyzing+Java+Projects

In few words, the parameter sonar.dynamicAnalysis must be set to false in
order to prevent unit tests execution and you MUST NOT activate Findbugs
rules as Findbugs needs first to compile sources.

Hope it helps,
Freddy

On Fri, Sep 4, 2009 at 4:03 PM, Peter Horlock
Post by Peter Horlock
Hmm - yes - and no.
We are still having a mixture of Ant and Maven.
exec] [INFO] Building Project
[org.codehaus.mojo:cobertura-maven-plugin:2.3:cobertura]
[exec] [INFO]
------------------------------------------------------------------------
[exec] [INFO] Preparing cobertura:cobertura
[exec] [INFO] [build-helper:add-source {execution: default}]
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/build.maven/generated-src
added.
[exec] [INFO] [resources:resources]
[exec] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[exec] [INFO] skip non existing resourceDirectory
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/src/main/resources
[exec] [INFO] [compiler:compile]
[exec] [INFO] Compiling 46 source files to
/home/machine/opt/hudson-work/jobs/sonar_project/workspace/folder/Project/build.maven/classes
[exec] [INFO]
------------------------------------------------------------------------
[exec] [ERROR] BUILD ERROR
[exec] [INFO]
------------------------------------------------------------------------
[exec] [INFO] Can not execute Sonar
[exec]
[exec] Embedded error: Unable to execute maven plugin
[exec] Compilation failure
----------------------------------------
it's so that we do have written an ant target, besides other stuff it auto
creates source code based on xml files.
The ant task knows where to find those files and handles everything
correctly. However,
calling a "mvn clean install" fails on that project. Well, to be honest, I
don't know too much about the entire process, cause
it was defined by someone else. However, what I do know is - all that was
working with sonar 1.1.7, so it should still be working
in 1.1.10.1, right???
Thanks in advance,
Peter
Peter Horlock
2009-09-06 06:19:47 UTC
Permalink
Hi Freddy, thanks for your reply.
Has all this changed since version 1.7?

Thanks,

Peter
Post by Freddy Mallet
Hi Peter,
The following documentation describes how to make Sonar working with
http://docs.codehaus.org/display/SONAR/Analyzing+Java+Projects
In few words, the parameter sonar.dynamicAnalysis must be set to false in
order to prevent unit tests execution and you MUST NOT activate Findbugs
rules as Findbugs needs first to compile sources.
Hope it helps,
Freddy
Loading...