The XRadar Maven2 plugin documentation (version 1.1-beta-1)

New features :

  • Dynamic audit is available.
  • There is 3 ways to use XRadar's plugin :
    • automatic mode : you only have to declare maven-xradar-plugin as shown below. XRadar will download and execute all the reports tools plugins with default configuration.
    • custom mode : use your custom report plugin tools configuration. declare desired plugins and configurations then maven-xradar-plugin. XRadar will execute your plugin's configuration and default ones for the not declared plugins. Note that if you put "autoRadar" parameters to "false", XRadar will only execute your plugins.
    • aggregator mode use already created report's files : No report plugins are executed. XRadar will just aggregate your report files.

To add XRadar report to your site, you must add the maven-xradar-plugin to the special reporting section in the POM as the last report :
				
<reporting>
  <plugins>
  
  ...
  	
    <plugin>
  	  <groupId>net.sf.xradar</groupId>
  	  <artifactId>maven-xradar-plugin</artifactId>
  	  <version>1.1-beta-1</version>
  	</plugin>
  </plugins>
</reporting>
			
			

Automatic mode (default mode)

Just add the maven-xradar-plugin declaration in your pom, then execute mvn site :

				
<reporting>
  <plugins>
    <plugin>
  	  <groupId>net.sf.xradar</groupId>
  	  <artifactId>maven-xradar-plugin</artifactId>
  	  <version>1.1-beta-1</version>
  	</plugin>
  </plugins>
</reporting>
			
			

See the result in the report section of your project's site.

Custom mode

Add your custom configurations and at last the maven-xradar-plugin declaration in your pom, then execute mvn site or mvn clean compile site :

For example :

				
<reporting>
  <plugins>	
  
  ...
  
    <plugin>
      <artifactId>maven-pmd-plugin</artifactId>
        <configuration>
			<linkXref>true</linkXref>
			<sourceEncoding>utf-8</sourceEncoding>
			<minimumTokens>100</minimumTokens>
			<targetJdk>1.5</targetJdk>
		</configuration>
	</plugin>
	
  ...	

	<plugin>
  	  <groupId>net.sf.xradar</groupId>
  	  <artifactId>maven-xradar-plugin</artifactId>
  	  <version>1.1-beta-1</version>
  	  <configuration>
  	    <autoRadar>true</autoRadar> <!--false to execute only the plugins declared-->
  	  </configuration>
  	</plugin>
  </plugins>
</reporting>
			
			

Aggregator mode

Add the maven-xradar-plugin declaration in your pom and configure the path to the already report files generated, then execute mvn site :

For example :

				
<reporting>
  <plugins>	
	<plugin>
  	  <groupId>net.sf.xradar</groupId>
  	  <artifactId>maven-xradar-plugin</artifactId>
  	  <version>1.1-beta-1</version>
  	  <configuration>
  	    <autoRadar>false</autoRadar> <!--need to be set at false-->
  	    <reportPmd>${project.build.directory}/resources/pmd.xml</reportPmd>
  		<reportCheckstyle>${project.build.directory}/resources/checkstyle.xml</reportCheckstyle>
      </configuration>
  	</plugin>
  </plugins>
</reporting>
			
			

What do you need else ?

To analyse your project, XRadar, and therefore its maven plugin, needs a couple more files:

  1. src/main/resources/xradar/radar-config.xml
  2. src/main/resources/xradar/release{version}.properties , (where {version} is the version of your project declared in its pom.xml)

Note, that if you didn't create those files XRadar will use default ones.

you can see default files as examples here : xradar-config-default.xml and here : default-release.properties

To have XRadar static and dynamic analyse of your project run " mvn site ". To be sure that your are analysing the last version of your code run " mvn clean compile site ".

WARNINGS :

  • the "projectVersion" declared in the pom of your project must match with the filename "src/main/resources/xradar/release{version}.properties" and the field "version.label={version}" declared inside the release{version}.properties file.
  • for the first use, you have to put "sequence.id=1" in the release{version}.properties file.
  • the maven-site language configuration doesn't work, so don't add the following :
    							
    <locales>...</locales>
    			
    						
  • the reports from surfire are not added. So no cover test metrics.
  • when reports plugins are declared in profile, maven-xradar-plugin cannot load them. It took default configuration.

Bug fixes (from 1.1-beta-1) :

  • multi-module projects can now be audited.
  • if maven-xradar-plugin is declared in a profile, it is now well executed.

Configure the plugin :

The plugin comes with a lot of possible option to configure:

				
<build>
  <sourceDirectory>path/to/source</sourceDirectory> <!--if different from src/main/java-->
  	<plugins>
  	  <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
  	</plugins>
  </build> 
<reporting>
   <plugins>
       <plugin>
  	     <groupId>net.sf.xradar</groupId>
  		 <artifactId>maven-xradar-plugin</artifactId>
  		 <version>1.1-beta-1</version>
  		 <configuration>
  		   <xradarTarget>${basedir}/releaseStatic/docs/</xradarTarget>
  		   <xradarConfig>${basedir}/etc/xradar-config-default.xml</xradarConfig>
  		   <xradarProperties>${basedir}/etc/default-release.properties</xradarProperties>
  		   <javadocEnabled>true</javadocEnabled>
  		   <debug>true</debug>
  		</configuration>
  	</plugin>
  </plugins>
</reporting>
			
			

You can change any of those parameters. Here is a quick ref:

Parameter Description Default value
autoRadar the automatic mode true
JavadocRoot The project's Javadoc location ${project.build.directory}/site/apidocs
xradarConfig Location of XRadar configuration file ${basedir}/src/main/resources/xradar/radar-config.xml
xradarJava2htmlRoots The radar Java2htmlRoot ${project.build.directory}/site/xref
debug The debug mode false
xradarProperties The xradar's properties ${basedir}/src/main/resources/xradar/release${project.version}.properties
xradarTarget The radar target for docs ${basedir}/xradar/release${project.version}/docs/
reportJdepend Location of the generated Jdepend's report ${project.build.directory}/jdepend-report.xml
reportCkjm Location of the generated ckjm's report ${project.build.directory}/ckjm-report.xml
reportCpd Location of the generated cpd's report ${project.build.directory}/cpd.xml
reportPmd Location of the generated pmd's report ${project.build.directory}/pmd.xml
reportCheckstyle Location of the generated checkstyle's report ${project.build.directory}/checkstyle-result.xml
reportJavancss Location of the generated javancss's report ${project.build.directory}/javancss-raw-report.xml
enableCkjm true to enable, false to disable true
enablePmd true to enable, false to disable true
enableCpd true to enable, false to disable true
enableCheckstyle true to enable, false to disable true
enableJavancss true to enable, false to disable true
enableJxr true to enable, false to disable true
enableJavadoc true to enable, false to disable true

plugins Supported :

plugin name plugin version (automatic mode)
Jdepend 2.9.1 (core version)
Ckjm 0.3
Pmd 2.4
Cpd
Checkstyle 2.2
Javancss 2.0-beta-2
Jxr 2.1
Javadoc 2.5

The XRadar Maven2 plugin documentation (version 0.1)

To use the maven-xradar-plugin, simply add to the pom.xml file to be analysed the following lines:

				
<reporting>
  <plugins>	
    <plugin>
  	  <groupId>net.sf.xradar</groupId>
  	  <artifactId>maven-xradar-plugin</artifactId>
  	  <version>0.1</version>
  	</plugin>
  </plugins>
</reporting>
			
			

What do you need else ?

To analyse your project, XRadar, and therefore its maven plugin, needs a couple more files:

  1. etc/radar-config.xml
  2. etc/xradar.properties

You must declare in the pom the plugins report tools you need ( at least JDepend ) from the following :

  • ckjm
  • pmd
  • checkstyle
  • javancss

To have XRadar analysing your project run " mvn site" .

Note, that you can use xradar-config-default.xml and default-release.properties , if you do not have the time to create thoses files.


Add both them in a etc/ folder and rename them radar-config.xml and xradar.properties or configure the plugin as shown below.

As the site taks of maven can be quite long, you may want to skip it and only get analysis from xradar. In this case, simply run " mvn net.sf.xradar:maven-xradar-plugin:audit " and see the result in the folder release1.

As soon as your project evolve a little bit you can produce what we called a dynamic analysis that will display how the project quality is evolving !

Configure the plugin :

The plugin comes with a lot of possible option to configure:

				
<reporting>
   <plugins>
       <plugin>
  	     <groupId>net.sf.xradar</groupId>
  		 <artifactId>maven-xradar-plugin</artifactId>
  		 <version>0.1</version>
  		 <configuration>
  		   <xradarTarget>${basedir}/releaseStatic/docs/</xradarTarget>
  		   <xradarConfig>${basedir}/etc/xradar-config-default.xml</xradarConfig>
  		   <xradarProperties>${basedir}/etc/default-release.properties</xradarProperties>
  		   <javadocEnabled>true</javadocEnabled>
  		   <debug>true</debug>
  		   <reportJdepend>${project.build.directory}/resources/jdepend-report.xml</reportJdepend>
  		   <reportCkjm>${project.build.directory}/resources/reportCkjm.xml</reportCkjm>
  		   <reportCpd>${project.build.directory}/resources/cpd.xml</reportCpd>
  		   <reportPmd>${project.build.directory}/resources/pmd.xml</reportPmd>
  		   <reportCheckstyle>${project.build.directory}/resources/checkstyle.xml</reportCheckstyle>
  		   <reportJavancss>${project.build.directory}/resources/javancss-raw-report.xml</reportJavancss>
  		</configuration>
  	</plugin>
  </plugins>
</reporting>
			
			

You can change any of those parameters. Here is a quick ref:

Parameter Description
JavadocRoot The project's Javadoc location
xradarConfig Location of XRadar configuration file
xradarJava2htmlRoots The radar Java2htmlRoot
debug The debug mode
xradarProperties The xradar's properties
xradarTarget The radar target for docs
reportJdepend Location of the generated Jdepend's report
reportCkjm Location of the generated ckjm's report
reportCpd Location of the generated cpd's report
reportPmd Location of the generated pmd's report
reportCheckstyle Location of the generated checkstyle's report
reportJavancss Location of the generated javancss's report

Warnings:

  • Java2html doesn't work. You have to run it on your own and then give the root directory.
  • JUnit and Cobertura report are not merged yet.