Discussion:
Analyse multi-modules project with ant task 1.1
Daniel Raap
2011-06-10 07:14:17 UTC
Permalink
Hello list,



i've tried to analyze our ant build software with sonar. Because it consists
of different parts which are separate eclipse projects I wanted to use the
new multi-modules feature of the sonar ant task 1.1. But for me it doesn't
work and always complains about "SonarException: Can not add twice the same
measure on .".



I think the problem is, that the workdir already contains results of that
sensor. At the moment it fails for the second module at "Sensor
ProfileSensor..." because I created an empty quality profile. Else it was
failing at "Squid extraction..." with quality profile "Sonar way".



Here are the build.xml snippets according to the example in the wiki
(http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task#AnalysewithAnt
Task-Analysemultimodulesproject):

Parent:

<target name="sonar">

<property name="sonar.jdbc.url" value="." />

<property name="sonar.jdbc.driverClassName"
value="com.mysql.jdbc.Driver" />

<property name="sonar.jdbc.username"
value="." />

<property name="sonar.jdbc.password"
value="." />

<property name="sonar.host.url"
value="http://sonar:80" />



<property name="sonar.modules"
value="Child1/build.xml,Child2/build.xml,Child3/build.xml,Child4/build.xml"
/>



<sonar:sonar key="com.example:Parent"
version="1.0" xmlns:sonar="antlib:org.sonar.ant"/>

</target>



Child1 and Child2 have these properties global in the build.xml (directly
underneath the <project> tag):

<property name="sonar.projectKey" value="com.example:Child1" />

<property name="sonar.sources" value="${src.dir}" />

<property name="sonar.binaries" value="${compiled.classes}" />

<property name="sonar.libraries" value="${lib.dir}" />

<property name="sonar.profile" value="Empty" />

<property name="sonar.dynamicAnalysis" value="false" />



Find the ant output attached.



Is there a property that has to be defined where to place the reports or is
the multi-module functionality not yet working properly?





Best regards
Daniel Raap
Freddy Mallet
2011-06-13 13:48:36 UTC
Permalink
Hi Daniel,

According to your log file, there seems to be a bug on the way you define
the Sonar module key on each module :

key=ch.totemo.development:${name}

So I guess at least two modules have the same key because the property
${name} is not interpreted.

Kind regards,
Freddy

----------------------------------------
Freddy Mallet
www.SonarSource.org
www.SonarSource.com
----------------------------------------
Post by Daniel Raap
Hello list,
i’ve tried to analyze our ant build software with sonar. Because it
consists of different parts which are separate eclipse projects I wanted to
use the new multi-modules feature of the sonar ant task 1.1. But for me it
doesn’t work and always complains about “SonarException: Can not add twice
the same measure on 
”.
I think the problem is, that the workdir already contains results of that
sensor. At the moment it fails for the second module at “Sensor
ProfileSensor...” because I created an empty quality profile. Else it was
failing at “Squid extraction...” with quality profile “Sonar way”.
Here are the build.xml snippets according to the example in the wiki (
http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task#AnalysewithAntTask-Analysemultimodulesproject
<target name="sonar">
<property name="sonar.jdbc.url" value="
" />
<property name="sonar.jdbc.driverClassName"
value="com.mysql.jdbc.Driver" />
<property name="sonar.jdbc.username"
value="
" />
<property name="sonar.jdbc.password"
value="
" />
<property name="sonar.host.url" value="
http://sonar:80" />
<property name="sonar.modules"
value="Child1/build.xml,Child2/build.xml,Child3/build.xml,Child4/build.xml"
/>
<sonar:sonar key="com.example:Parent"
version="1.0" xmlns:sonar="antlib:org.sonar.ant"/>
</target>
Child1 and Child2 have these properties global in the build.xml (directly
<property name="sonar.projectKey" value="com.example:Child1" />
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.binaries" value="${compiled.classes}" />
<property name="sonar.libraries" value="${lib.dir}" />
<property name="sonar.profile" value="Empty" />
<property name="sonar.dynamicAnalysis" value="false" />
Find the ant output attached.
Is there a property that has to be defined where to place the reports or is
the multi-module functionality not yet working properly?
Best regards
Daniel Raap
Loading...