I have a multi module project (with many sub-modules) defined in Sonar and it was working great until i've upgraded sonar to the newer version.
My previous settings were:
- a single parent
build.xml
that contain all of the general project properties like jdbc connection etc. Also it contained the<sonar:sonar />
task to run Sonar. This parent project does not contain any source / binaries, just the instruction to build the sub-modules. - many sub-modules
build.xml
files that contained only the sub-module specific properties likesonar.projectKey
,sonar.sources
andsonar.binaries
Now in the new Sonar ant task I need to define everything in the parent buid.xml
. I have defined it in the following way (I only show one sub-module here, I assume it should work the same if I add more modules later) :
<target name="sonar">
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="build-utils/lib/sonar-ant-task-2.0.jar" />
</taskdef>
<!-- list of Sonar database related properties -->
<property name="sonar.jdbc.url" value="jdbc:oracle:thin:@localhost/DB11g" />
<property name="sonar.jdbc.driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<!-- for security reasons, pass these parameters from outside -->
<property name="sonar.jdbc.username" value="" />
<property name="sonar.jdbc.password" value="" />
<property name="sonar.host.url" value="http://localhost:9000" />
<!-- list of Sonar project related properties -->
<property name="sonar.projectName" value="My Project" />
<property name="sonar.projectKey" value="com.my.project" />
<property name="sonar.projectVersion" value="7.3" />
<property name="sonar.language" value="java" />
<property name="sonar.libraries" value="server/third-party-jars"/>
<property name="sonar.modules" value="admin-api" />
<!-- all of the sub-modules -->
<property name="admin-api.sonar.projectName" value="admin-api" />
<property name="admin-api.sonar.projectBaseDir" location="server/admin/admin-api"/>
<property name="admin-api.sonar.sources" value="src" />
<property name="admin-api.sonar.binaries" value="build" />
<sonar:sonar xmlns:sonar="antlib:org.sonar.ant" />
</target>
When I run the target I get the following error:
You must define the following mandatory properties for 'com.orca.rightv': sonar.sources
Another question, is there any way to keep the specific definition of the sub-modules in each module's build.xml
like I did in the previous version ? That would save me a lot of work.
Thanks