Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 653
hawkeye Avatar asked Oct 31 '16 05:10

hawkeye


People also ask

How do I create a sonar scan for my project?

Go to your project folder which you want to scan. Create one new file inside your project's root folder path with name “sonar-project”. The extension of the file will be “.properties”. Add the following basic configurations inside “sonar-project.properties” file.

What if a sonar project cannot be created in the root directory?

If a sonar-project.properties file cannot be created in the root directory of the project, there are several alternatives: The properties can be specified directly through the command line.

Can I use the sonarscanner CLI to analyze a net project?

Scanner CLI is not able to analyze .NET projects. Please, use the SonarScanner for .NET. If you are running the SonarScanner for .NET, ensure that you are not hitting a known limitation.

How do I run SonarQube scanner from terminal?

Run SonarQube Scanner on your project. Now, you are all set for your scanning your code. Open “terminal.app” (for other OS Platform “Command prompt”), and from terminal, go to the folder path where your project code resides. Run this command to scan your code.


Video Answer


1 Answers

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.

like image 107
hawkeye Avatar answered Oct 23 '22 04:10

hawkeye