I would like to share my first experiment of test coverage for a multi-module maven project with sonar and JaCoCo.
Prerequisites :
Sample project :
I have a multi-module project with the following structure:
mySeamApp mySeamApp-ear mySeamApp-ejb mySeamApp-tests mySeamApp-util mySeamApp-war
This example was generated from seam-ear-archetype ( http://code.google.com/p/open-archetypes/ )
Setps of experiment :
1) Unzip the sample project : multimodulecoverage.zip
2) Download the jacoco agent from ${your_sonarserver_url}/deploy/plugins/jacoco/agent-all-0.4.0.20100604151516.jar
3) Compile and test projects:
mvn clean test -DargLine="-Dsun.lang.ClassLoader.allowArraySyntax=true -Xms512m -Xmx512m -javaagent:D:\Users\jer\agent-all-0.4.0.20100604151516.jar=destfile=../target/itjacoco.exec,append=true,includes=org.printstacktrace.*,excludes=*_javassist_*"
4) Generate the sonar information without test:
mvn sonar:sonar -Dsonar.core.codeCoveragePlugin=jacoco -Dsonar.jacoco.itReportPath=..\target\itjacoco.exec -Dmaven.test.skip
5) Inspect the sonar server pages:
It works!
Pingback: Tweets that mention Multi-module code coverage with JaCoCo and Sonar! « myExperiments.printStackTrace(); -- Topsy.com