Message-ID: <777913635.159.1406216159611.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_158_45405760.1406216159611" ------=_Part_158_45405760.1406216159611 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This page describes how to integrate SonarQube into a build script for A= pache Ant.
The Ant task is a thin wrapper around the SonarQube Runner, which works = by invoking the runner and passing to it all properties named following a s= onar.* convention. This has the downside of not being very Ant-y, but the u= pside of providing instant availability of any new analysis parameter intro= duced by a new version of a plugin or of SonarQube itself. Therefore, succe= ssful use of the SonarQube Ant task requires strict adherence to the pr= operty names shown below.
You may also consult the list of analysis parameters for additional properties which will be hon= ored in an Ant-based analysis.
Define a new
sonar Ant target in your Ant build script:
Run the following command from the project base directory to l= aunch the analysis:
Any user who's granted Execute Analysis permission can run an analysis.
If the Anyone group is not granted Execute A=
nalysis permission or if the SonarQube instance is secured (the
eAuthentication property is set to
true), the credentials of a user having been granted Execut=
e Analysis permission have to be provided through the
sonar-runner -Dsonar.login=3DmyLogin -Dsonar.passwor=
Note that for a preview/increme= ntal analysis, the user also has to be granted the Browse = ;permission on the project to be analyzed.
If a project cannot be accessed anonymously, the
sonar.password properties =
are required to run an analysis on this project. These properties have to b=
e set to the credentials of a user having the User role =
on this project. You can set them either:
-Dsonar.login=3DmyLog= in -Dsonar.password=3DmyPassword
A project cannot be anonymously accessed when either:
sonar.forceAut= henticationproperty is set to
sonar.force= Authenticationproperty is set to
false&n= bsp;and the Anyone group has not been granted a User role on the project
There is no security restriction.
Since SonarQube 4.2, it is possible to run an analysis on a multi-langua=
ge project. To do so, the
sonar.language property ju=
st has to be removed. Conversely, if for some reason you want to perfo=
rm a single language-only analysis, make sure
sonar.language is specified.
The first step is to choose which one of these two mono-language project= s you will convert to a multi-language project. You will lose the history (= timeline, false positives, action plans, etc.) on the one that won't get co= nverted to a multi-language project. In this example, we'll choose to conve= rt the Java project to a multi-language project as most of our code (and th= erefore history) is Java.
The second step is to run another analysis of this Java project the old =
way (make sure to explicitly set the
java). This step is mandatory to keep the his=
tory on the project.
The third and last step is to remove the
sonar.language property and set the
sonar.sources property t=
You can now run another analysis. You will finally be able to browse your =
first multi-language project!
The configuration for parent and modules must be done in the parent = build.xml file:
Additional analysis parameters can be defined= in the build.xml file or through command-line parameters.