Message-ID: <860713704.790702.1386622285335.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_790701_1944886613.1386622285335" ------=_Part_790701_1944886613.1386622285335 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 Analysis&nb=
sp;permission or if the SonarQube instance is secured (the
nar.forceAuthentication property is set to
true), the credentials of a user havi=
ng been granted Execute Analysis permission have to be provid=
ed through the
sonar-runner -Dsonar.login=3DmyLogin -Dsonar.p=
SonarQube 3.4 to 3.6.3
If a project cannot be accessed anonymously, the
sonar.password properties are required to run =
an analysis on this project. These properties have to be set to the credent=
ials of a user having the User role on this project. You can set t=
-Dsonar.login=3DmyLogin -D= sonar.password=3DmyPassword
A project cannot be anonymously accessed when either:
sonar.forceAuthenti= cationproperty is set to
sonar.forceAuthe= nticationproperty is set to
falseand the Anyone group has not been granted a User role on the project=
There is no security restriction.
The configuration for parent and modules must be done in the parent = build.xml file:
Since SonarQube 3.3, it is possible to run an analysis on a multi-module= project whose modules contains source code from different languages.
In addition to the multi-module configuration, the only mandatory property = to set is the language for each module:
Additional analysis parameters can be defined= in the build.xml file or through command-line parameters.
The SonarQubeAnt Task 2.0 can run analyses from configuration files desi= gned for SonarQube Ant Task 1.X.
This compatibility mode is automatically activated. But we highly r= ecommend you to migrate to the new format as this compatibility mode will b= e dropped sooner or later in the next versions.