Archive for the 'SonarQube' Category

Cobertura in SonarQube with Jenkins and JaCoCo for Maven Multi-Module Projects

There is a typical issue when you try to analyze a Maven multi-module project in SonarQube: the cobertura reports are lost. So, when using Jenkins you have to configure your job with:

  • In the build section, use:
clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Dmaven.test.failure.ignore=true -Djacoco.destFile=${WORKSPACE}/target/jacoco.exe

1

  • In the Post Steps, use a “Execute SonarQube Scanner” with:
sonar.jacoco.reportPath=${WORKSPACE}/target/jacoco.exec

2.png

The first configuration allows that all executions of JaCoCo maven plugin publish the results in the same file (by default it appends the results). The second one, tells to SonarQube where to find the JaCoCo results.


Enhanced Links