Products Downloads


French version


 

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.


The analysis is separated into two phases:

  • An initial phase involving executing the Adelia quality manager in the command line and preparing sources and quality data for integration into SONAR (adelqual:adelqual).
  • A second phase involving integrating data generated in SONAR (sonar:sonar).


The initial phase is taken into account by a Maven plugin (Adelia quality plugin). This restricts the compatibility with Maven (the autonomous Java Runner is not supported).


You can then use the example script below, specifying the properties required to access the Adelia repository, i.e. at the least (adelqual.environ = <environment_name>, sonar.sources = <generated_sources_directory> and the connection parameters to SONAR).


Important:

With Java 8, 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

NB:

The "sonar.profile" property is deprecated in all versions of Sonar taken into account by version 3.x of the plugin, and is not taken into account by the adelqual plugin. The analysis is performed using the rules profile associated with the project in Sonar, or using the default profile if it is the first analysis (project creation).


The project can be created in advance in Sonar and assigned a rules profile. Make sure that the project key complies with the "groupId:artifactId" standard, with groupId and artifactId corresponding to the information specified in your maven project.


For example, if your project contains the following information:

<groupId>com.mycompany</groupId>

<artifactId>test</artifactId>

<name>Test</name>

The Test project must be created in Sonar with the "com.mycompany:test" key.


Example

The following example uses the template provided on the Sonar website, commenting the data to provide and specifying superfluous parameters in gray.

<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>

 

    <properties>

        <sonar.host.url>[URL_HOST]</sonar.host.url>

        <sonar.login>[LOGIN]</sonar.login>

        <sonar.password>[PASSWORD]</sonar.password>

        <sonar.sources>[SOURCE DIRECTORY]</sonar.sources>

    </properties>

 

    <build>

        <plugins>

            <plugin>

                <groupId>com.hardis.maven.plugins</groupId>

                <artifactId>adelqual-maven-plugin</artifactId>

                <version>1.1 </version>

                <configuration>

                    <environ>[ENVIRONMENT NAME]</environ>

                </configuration>

            </plugin>

        </plugins>

    </build>

 

 </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_HOST

Access URL for the SONAR repository.

LOGIN

Connection profile (if needed).

PASSWORD

Connection password for the profile.

ENVIRONMENT NAME

Name of the Adelia environment.

SOURCE DIRECTORY Directory in which sources are generated.

The specific properties for project analysis by the Adelia plugins are as follows:

sonar.sources

mandatory

he Adelia plugin extracts the source files and quality data into a directory during the analysis phase (Adelqual plugin).

This data will be imported into SONAR in the integration phase (Sonar plugin).
Not all SONAR versions specify this parameter, in which case it must be specified by the user.

adelqual.environ

mandatory

Adelia environment.

adelqual.genMode

optional

This option is used to determine the manner in which Adelia recalculates program quality data before integration into SONAR.

Possible values:

delta

Only those programs modified since the last integration are analyzed.

This is the default value.

full

All of the project's programs will be analyzed.

none

Repository data are integrated but no programs are analyzed.

In this case, the data may not match the SONAR rules profile definition.

Note: SONAR current versions don't allow you to detect the SONAR rule profile configuration changes.

If the rule profile is modified, it is your responsibility to restart the analysis in "full" mode when you change the SONAR configuration.


adelqual.createObjects

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).

adelqual.locale

optional

Locale to be used for connecting to Adelia and generating violation messages.

Possible values : "fr" or "en" ("en" by default).


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 adelqual:adelqual sonar:sonar". If necessary, the project is automatically created in SONAR.


Note on the integration:

The Adelia Maven plugin was developed in order to maintain backward compatibility with the previous version.


The specific properties of the plugin are initialized by default with their equivalent in the previous version (e.g. adelqual.environ is initialized with the sonar.adelia.environ value).

This means that if Maven is properly configured for prefix resolution, the former projects can be used without modification. It is, however, preferable to re-write the projects in the new format.


To resolve the adelqual plugin automatically (i.e. to avoid the need to register it explicitly in the pom.xml), you must add the "com.hardis.maven.plugins" group to the "pluginGroups" section of the Maven configuration file (settings.xml).

<pluginGroups>

<pluginGroup>com.hardis.maven.plugins</pluginGroup>

</pluginGroups>

↑ Top of page

  • Aucune étiquette