Why doesn't my sonar scanner run create a report-task.txt file?

hawkeye picture hawkeye · Oct 31, 2016 · Viewed 13.3k times · Source

I'm trying to get my build to break based on sonar results - so I've got a build-breaker running off the results in report-task.txt.

I'm running sonar in maven - with the following plugin config:

<plugin>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.0.1</version>
</plugin>

And the following command:

mvn  -Dsonar.analysis.mode=preview -Dsonar.scm.enabled=false -Dsonar.scm-stats.enabled=false -Dsonar.working.directory=/mypath/target/.sonar

Now I expect the report-task.txt to be created in /mypath/target/.sonar but it is not.

SonarQube version: Version 5.5

My question is: Why doesn't my sonar scanner run create a report-task.txt file?

Answer

hawkeye picture hawkeye · Nov 27, 2016

This is what is stopping it:

-Dsonar.analysis.mode=preview

You have to change it to:

-Dsonar.analysis.mode=

The assumption being you will have to upload bad builds and then trap them with a leak-period of 3 days instead of previous version.