9

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?

hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • What versions are you using? – G. Ann - SonarSource Team Oct 31 '16 at 11:11
  • SonarQube has posted a [Why You Shouldn’t Use Build Breaker](http://www.sonarqube.org/why-you-shouldnt-use-build-breaker/) article. It seems that [SonarQube 5.4](http://docs.sonarqube.org/display/SONARQUBE54/Breaking+the+CI+Build) is last the version supporting it. – Jeroen Heier Nov 01 '16 at 05:58
  • That's an interesting article - I could say quite a bit about it. Let's assume for the purpose of this question I've already read it, and still need a build breaker solution. – hawkeye Nov 01 '16 at 06:10

3 Answers3

6

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.

hawkeye
  • 34,745
  • 30
  • 150
  • 304
0

If your version is greater than 6.6 use analysis parameter sonar.working.directory=path

Shubham Gorlewar
  • 404
  • 4
  • 11
0

I had the same issue of not finding the report where I expected, in my case it was because the default report path for sonar-maven-plugin:3.9.1+SonarQube server 9.9 was target/sonar/report-task.txt.

cmousset
  • 625
  • 7
  • 21