Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running SonarQube analysis scan - SonarSource build-wrapper

I'm new to running SonarQube scans and I get this error message in the log in Jenkins:

16:17:39 16:17:36.926 ERROR - The only way to get an accurate analysis of your C/C++/Objective-C project is by using the SonarSource build-wrapper. If for any reason, the use of the build-wrapper is not possible on your project, you can bypass it with the help of the "sonar.cfamily.build-wrapper-output.bypass=true" property. By using that property, you'll switch to an "at best" mode that could result in false-positives and false-negatives.

Can someone please advise where I can find and run this SonarSource build-wrapper?

Thanks a lot for your help!

like image 971
DoruF Avatar asked Nov 22 '16 16:11

DoruF


People also ask

What is SonarQube build wrapper?

The Build Wrapper does not impact your build; it merely monitors it and writes what it learns into files in a directory you specify. You should download the Build Wrapper directly from your SonarQube server so that its version perfectly matches your version of the plugin.

Which is used to run the SonarQube analysis?

Developers code in their IDEs and use SonarLint to run local analysis. Developers push their code to their favorite SCM. The Continuous Integration Server triggers an automatic build, and the execution of the Sonar Scanner required to run the SonarQube Analysis.

Can SonarQube scan .NET code?

The SonarScanner for . NET is the recommended way to launch an analysis for projects/solutions using MSBuild or dotnet command as a build tool. It is the result of a collaboration between SonarSource and Microsoft.


2 Answers

To solve this issue, download the Build Wrapper directly from your SonarQube Server, so that its version perfectly matches your version of the plugin:

Build Wrapper for Linux can be downloaded from URL

http://localhost:9000/static/cpp/build-wrapper-linux-x86.zip

Unzip the downloaded Build Wrapper, Configure it in your PATH because it's just more convenient

export PATH=$PATH:/path/where/you/unzip

Once done, Run below commands.

build-wrapper-linux-x86-64 --out-dir <dir-name> <build-command>
build-wrapper-linux-x86-64 --out-dir build_output make clean all

Once all this done, you have to modify your sonar-project.properties file with following line. Note the dir-name is same directory which we defined in previous command.

sonar.cfamily.build-wrapper-output=<dir-name>

and then you can run the sonar scanner command.

sonar-scanner

this will do the analysis against your code. For more details, you can check this link.

like image 168
Abhijeet Kamble Avatar answered Sep 19 '22 14:09

Abhijeet Kamble


Contacted support, turns out this was caused by missing the argument sonar.cfamily.build-wrapper-output in the scanner begin command.

like image 35
cucu Avatar answered Sep 19 '22 14:09

cucu