Documentation on SonarQube Scanner for Jenkins incorrect or outdated

1,862 views
Skip to first unread message

hansvanlu...@gmail.com

unread,
Feb 16, 2016, 5:13:48 AM2/16/16
to SonarQube
I'm setting up Jenkins + SonarQube on a Windows Server 2012 machine and find the documentation to be incorrect and frustrating.


The screenshots display different options than are available to me, there is no explanation as to why this could be and I run in to (what seem to be) common problems that are not covered. I tried to register an account on your documentation site, but it seems I'm unable to find the registration page.

Could someone update the documentation? 

G. Ann Campbell

unread,
Feb 16, 2016, 7:22:45 AM2/16/16
to SonarQube, hansvanlu...@gmail.com
Hi,

Thanks for the feedback. Can you give some details on the problems you're encountering that aren't documented?


Thx,
Ann

On Tuesday, 16 February 2016 05:13:48 UTC-5:

hansvanlu...@gmail.com

unread,
Feb 16, 2016, 7:56:50 AM2/16/16
to SonarQube, hansvanlu...@gmail.com
I'll post things here as I encounter them.

On this page, in the Plugin Information table the GitHub link is dead and the issues link applies a filter that returns no results (component = 'sonar-plugin').

The 'Prerequisites' section on this page does not explicitly mention Maven as a dependency in Jenkins. I managed to install this plugin while having had the Maven plugin disabled, which lead to NullPointer errors when trying to save a job. Maybe the documentation should be updated, or even better, the dependency should be verified somehow.

The SonarQube portion on the Jenkins Configuration page looks different from the screen shot provided on this page, under 'Adding SonarQube Server', step 2. This is what it looks like for me: step 2 and step 3.


The part that explains how to fix not being able to see a drop down list under 'Adding SonarQube Scanner' could be an info block to signify it not being a step of the process while making it stand out more for people looking for this kind of info. I didn't find it during my first times of skimming the page. Only after carefully reading everything did I discover this important piece of info.

G. Ann Campbell

unread,
Feb 16, 2016, 10:10:43 AM2/16/16
to hansvanlu...@gmail.com, SonarQube
Gah! Original reply was not to 'all'

I'll post things here as I encounter them.

On this page, in the Plugin Information table the GitHub link is dead and theissues link applies a filter that returns no results (component = 'sonar-plugin').

Ah. Well, we don't maintain https://wiki.jenkins-ci.org/display/JENKINS/SonarQube+plugin (and never have, really). That's why there's a yellow banner that directs you to the documentation we do maintain.
 

The 'Prerequisites' section on this page does not explicitly mention Maven as a dependency in Jenkins. I managed to install this plugin while having had the Maven plugin disabled, which lead to NullPointer errors when trying to save a job. Maybe the documentation should be updated, or even better, the dependency should be verified somehow.

Can you give more details on this, please? At what point did you get an NPE?
 

The SonarQube portion on the Jenkins Configuration page looks different from the screen shot provided on this page, under 'Adding SonarQube Server', step 2. This is what it looks like for me: step 2 and step 3.

Screenshots removed :)
 

The part that explains how to fix not being able to see a drop down list under 'Adding SonarQube Scanner' could be an info block to signify it not being a step of the process while making it stand out more for people looking for this kind of info. I didn't find it during my first times of skimming the page. Only after carefully reading everything did I discover this important piece of info.


 Good point. Done.


---
G. Ann CAMPBELL | SonarSource
Product Owner

Hans van Luttikhuizen

unread,
Feb 18, 2016, 5:11:18 AM2/18/16
to SonarQube, hansvanlu...@gmail.com
I'm trying to set up a project with the MSBuild runner and I'm running into a lack of documentation of the configuration possibilities. This page offers very limited examples. To me as someone without any C# or MSBuild experience at all I require a documentation of the XML layout, all of the possible configuration options and how to define them, much like has been done with the sonar-project.properties settings file here.

Talking of which, this page nowhere states how to apply these 'analysis parameters' (e.g. by putting them in a sonar-project.properties file in the project root).

I got the NPE after roughly the following scenario I'm recalling from memory:
  1. Install Jenkins
  2. Disable Maven Plugin (along with a few others, some version control systems I didn't expect to need)
  3. Add a new Job
  4. Install the SonarQube Plugin in Jenkins (which depends on the Maven plugin, but I never got an error, maybe because the Maven was installed, but disabled?)
  5. Add the "Invoke Standalone SonarQube Analysis" build step.
  6. Try to either Save or Apply the job settings.
  7. NPE (No stack trace since I haven't tried to reproduce the problem after I resolved it)

Julien HENRY

unread,
Feb 18, 2016, 6:03:56 AM2/18/16
to SonarQube, hansvanlu...@gmail.com
Hi guys,

I think indeed we should improve the dependency on the Maven plugin to be optional or at least better documented. At the early days of the plugin the Maven part was a core feature of Jenkins but I think Jenkins itself is trying to be more independent of Maven.

Ticket created:

++

Julien

Dinesh Bolkensteyn

unread,
Feb 22, 2016, 4:48:36 AM2/22/16
to SonarQube
You'll want to use the dedicated MSBuild Scanner Jenkins build steps to analyze MSBuild project instead of the "Invoke Standalone SonarQube Analysis" one.

In additional arguments, you can optionally specify further arguments (such as coverage reports) using the syntax: /d:[property_key]=[property_value]
In general, all scanner properties are available, but I don't expect that you'll actually need to use many of them besides the C# specific ones.
See http://docs.sonarqube.org/display/PLUG/C%23+Plugin for useful properties available only when analyzing C# projects.

Also, you shouldn't have to edit the global MSBuild Scanner XML file. That file is global to the machine and cannot contain per-project configuration.

You should'll probably want the rely on the Jenkins SonarQube plugin to automatically deploy the MSBuild Scanner on your build machines, and not install the MSBuild Scanner manually on each build machine.
When doing so, the default settings file will be provisioned on the build machine, and you won't be able to customize it.

To specificy which SonarQube server to use, rely on the "SonarQube Installation" dropdown in the begin analysis step.

Hans van Luttikhuizen

unread,
Feb 24, 2016, 9:18:05 AM2/24/16
to SonarQube
Thank you for taking the time to reply. If I understand correctly and I were to set up a project that has both C# and JavaScript, I would need to run the MSBuild Scanner and pass every single sonar.* option as an "additional argument" in the Jenkins plugin?

So my question has two parts:
  1. Is there no way to pass project-specific settings to the MSBuild Scanner through the Jenkins Plugin?
  2. What is the best way to scan a project for both C# code and JavaScript code while having the results show up in the same SonarQube project?
For the second question I've tried running the MSBuild Scanner and the regular scanner separately, but then only the last results show up, overriding the previous results.

Dinesh Bolkensteyn

unread,
Feb 24, 2016, 9:30:58 AM2/24/16
to Hans van Luttikhuizen, SonarQube
If you're using the same SonarQube project key for both analysis, then they indeed will overwrite eachother. If you want to go ahead with that approach, you can use distinct keys and use the portfolio management plugin to aggregate the 2 projects into a single virtual one.

However I'd recommend that you analyze your project just once using the MSBuild Scanner. The MSBuild Scanner computes sonar.sources and so on, so there is no need to set those properties. Start small with no properties, and add the ones you really need one by one.

For example, you'll want to pass the Javascript code coverage properties in the "Additional arguments" textbox of the MSBuild Scanner Begin build step using the syntax "/d:[propertyKey]=[propertyValue]". You can pass several arguments with this syntax, separating them by spaces. Quote the arguments that themselves do contain spaces.

I will update the MSBuild Scanner steps for the SonarQube Jenkins plugin shortly because it's indeed not clear enough in its current state.

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/aB1va3lruog/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/f8eb2e28-3f8f-4592-ae23-e6e132f066d0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hans van Luttikhuizen

unread,
Feb 25, 2016, 8:08:00 AM2/25/16
to SonarQube, hansvanlu...@gmail.com
Following your instructions I succeeded in passing additional configuration. However, I did not manage to get multi-language/module scanning to work.

I've tried using only the most basic settings in a sonar-project.properties (sonar.modules and module.sonar.src lines) and running the regular Sonar Runner, which picked up the JavaScript and Python example folders. Porting those properties to command line arguments did not seem to have any impact however, when running Sonar Runner for MSBuild. It successfully parses the properties, it seems, but only shows the C# scan results.

Is the Sonar Runner for MSBuild even capable of scanning non-MSBuild related languages? If so, how would one configure this?

I noticed the documentation, combined with the example projects, covers these kind of setups adequately for the standard SonarQube Scanner. However, multi-language/module projects aren't mentioned on the Sonar Runner for MSBuild documentation page which implies it should work by sticking to a regular configuration passed as command line arguments, which it doesn't.

Hans van Luttikhuizen

unread,
Apr 14, 2016, 3:59:07 AM4/14/16
to SonarQube, hansvanlu...@gmail.com
I've found a problem with the "Invoke Standalone SonarQube Analysis" build task. The documentation (http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins#AnalyzingwithSonarQubeScannerforJenkins-AnalyzingwiththeSonarQubeScanner) shows the options "Sonar Installation" and "Sonar Runner", neither of which are available to me:

G. Ann Campbell

unread,
Apr 14, 2016, 7:19:32 AM4/14/16
to Hans van Luttikhuizen, SonarQube
How many of each do you have configured @Hans? I'm guessing one, so there's no point in showing the option because there's no real "option".



---
G. Ann CAMPBELL | SonarSource
Product Owner

Hans van Luttikhuizen

unread,
Apr 14, 2016, 7:59:29 AM4/14/16
to SonarQube, hansvanlu...@gmail.com
Very good point, I had not thought of this. I have seen so many poorly configurable and badly responsive Jenkins plugins the past few weeks that I had assumed the worst.

Maybe you could update the documentation so it says that any of those two options are unavailable when only one of their items is configured?

G. Ann Campbell

unread,
Apr 14, 2016, 9:27:02 AM4/14/16
to Hans van Luttikhuizen, SonarQube
Since that's standard plugin behavior (not to present a tool choice when only one copy of the tool is configured) I don't feel it's worth mentioning in our docs.

If you don't believe me, try it out with a Maven build task. If only one instance of Maven is configured at the global level, you won't be able to pick which one to use. Add a second Maven, and you will. :-)



---
G. Ann CAMPBELL | SonarSource
Product Owner

Hans van Luttikhuizen

unread,
Apr 14, 2016, 9:32:02 AM4/14/16
to SonarQube, hansvanlu...@gmail.com
I did not know this. Thanks for your patience!
Reply all
Reply to author
Forward
0 new messages