Adelia is compatible with SONAR's standard data integration mechanisms, whether via Maven, Ant or the autonomous Java Runner provided by SONAR.
The integration example is based on the default Maven script used by SONAR. You must first install the Adelia plugin onto the SONAR server, then install and configure Maven to access the SONAR repository (as described in the SONAR online help) on the workstation performing the analysis.
You can then use the standard example script, specifying the properties required to access the Adelia repository, i.e. at the least (sonar.language = adel) et (sonar.adelia.environ = <environment_name>).
Important:
The default JAVA settings may be too restrictive in terms of memory allocation. We recommend increasing them, in particular the maximum stack size.
A Maven analysis can be performed by defining the MAVEN_OPTS environment variable.
The recommended value of this variable for Adelia is as follows:
set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m -Xss1m
Example
The following example uses the template provided on the Sonar website, commenting the data to provide and specifying any additional parameters required in red, along with superfluous parameters in gray.
NB: the Maven build is not used for Adelia. The entire "build" section is superfluous.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>[ORGANIZATION]</groupId>
<artifactId>[PROJECT ID]</artifactId>
<name>[PROJECT NAME]</name>
<version>[PROJECT VERSION]</version>
<build>
<sourceDirectory>[SOURCE DIRECTORY]</sourceDirectory>
<outputDirectory>[OBJECTS DIRECTORY]</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<excludes>
<exclude>**/*.*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<sonar.jdbc.url>[URL_JDBC]</sonar.jdbc.url>
<sonar.jdbc.username>[PROFILE]</sonar.jdbc.username>
<sonar.jdbc.password>[PASSWORD]</sonar.jdbc.password>
<sonar.language>adel</sonar.language>
<sonar.adelia.environ>[ENVIRONMENT NAME]</sonar.adelia.environ>
</properties>
</project>
The following parameters should be specified:
ORGANIZATION |
Name of the organization (e.g.: Hardis). |
PROJECT ID |
Internal name of the project in SONAR. This name is not displayed and must uniquely identify your project. E.g. : test_va.project_test |
PROJECT NAME |
The project's external name. Should correspond to the project name defined in the Adelia quality manager. E.g.: Test project |
PROJECT VERSION |
Your project's version. E.g.: 1.0 |
URL_JDBC |
Access URL for the database containing the SONAR repository. |
PROFILE |
Database connection profile. |
PASSWORD |
Password for the profile. |
ENVIRONMENT NAME |
Name of the Adelia environment. |
The specific properties for project analysis by the Adelia plugin are as follows:
sonar.sources |
optional |
To ensure compatibility with SONAR 4.x, the Adelia plugin now extracts the sources from a directory during the initialization phase. This directory, the "src/main/java" sub-tree of the Maven project by default, can be configured in version 4 and later of SONAR. It is preferable to create this directory before starting the analysis. If Adelia creates it automatically, the first analysis may fail in certain versions of SONAR. |
||||||
sonar.language |
mandatory |
Analyzed language, must be 'adel' for Adelia. |
||||||
sonar.adelia.environ |
mandatory |
Adelia environment. |
||||||
sonar.adelia.gen_mode |
optional |
This option is used to determine the manner in which Adelia recalculates program quality data before integration into SONAR. Possible values:
Note: If you use SONAR 2.9 to 4.1, the plugin detects the SONAR rule profile configuration changes and forces the analysis in "full" mode if you have selected delta mode and the rule parameters have been changed. For other versions, it is your responsibility to restart the analysis in "full" mode when you change the SONAR configuration.
|
||||||
sonar.adelia.create_objects |
optional |
This option is used to create compilation jobs during a project analysis. Important note: the plugin does not execute these jobs, they are managed by the Adelia quality manager. Possible values: "true", "false" ("false" by default). |
||||||
sonar.adelia.locale |
optional |
Locale to be used for connecting to Adelia and generating violation messages. Possible values: "fr" or "en" ("en" by default).
Replaces the SONAR parameter "sonar.violationLocale" which was removed in SONAR 4.1. This is still used if the Adelia parameter is not specified and you are using a version of SONAR earlier than 4.1. |
To perform the integration operation, you must save the file as "pom.xml" to a directory; you then go to this directory and run the command "mvn sonar:sonar". If necessary, the project is automatically created in SONAR.
For integration using Ant or Java Runner, the basic principle is identical, simply define the properties specific to Adelia (at the least: language = "adel" and environment name) as appropriate.