How to prevent SonarQube from skipping additional surefire executions?

1k Views Asked by At

My Maven project has multiple surefire executions configured to make sure different test groups get rund with slight modifications to the classpath etc. (see the pom.xml). When running the build job, the tests are executed as expected.

The build job running the Maven Sonar plugin only runs the default test execution and skips the other test configurations which effectively leads to Sonar reporting 0% test coverage. How can I tweak the Maven Sonar plugin to not skip the additional test executions. The relevant section from the log is here, the full log here.

I'd be interested in why the additional executions are skipped as well.

1

There are 1 best solutions below

1
On

The objective of SonarQube is not to run your unit tests, especially when the configuration is not standard. For you information, our long-term goal is to remove such a feature and only allow one mode: reuseReports.

Therefore you should run your unit tests first and reuse those generated reports while running the SonarQube analysis. See http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Unit+Tests+for+Java+Project#CodeCoveragebyUnitTestsforJavaProject-ReusingExistingReports.