Do I need sonar and sonar runner for Jenkins?

40,572

If you want to analyse a project with SonarQube and Jenkins, here's what you need:

  • A SonarQube server up and running

  • A Jenkins server up and running with the SonarQube Scanner for Jenkins installed and configure to point to your SonarQube server

  • A job configured to run a SonarQube analysis on your project:

    • Using the default and standard SonarQube Scanner (suitable for most projects)

    • Using the SonarQube Scanner for MSBuild (for .NET solutions)

    • Using a post build action for Maven-based projects

Everything is described more in details on the SonarQube Scanner for Jenkins documentation page.

Share:
40,572
user1338413
Author by

user1338413

Updated on April 19, 2020

Comments

  • user1338413
    user1338413 about 4 years

    I want to set up Sonar with Jenkins. But I'm not sure if the Sonar site describes two different ways to do this or if there are two necessary steps:

    As far as I understood it, it's two different ways. If this is the case, what is the difference and what are the advantages and disadvantages (between the Sonar itself and Sonar runner)?

  • Fabrice - SonarSource Team
    Fabrice - SonarSource Team over 11 years
    No, you're not obliged to edit settings.xml: choosing the Sonar server that you've configured in the global Jenkins settings should be enough.
  • Ian H
    Ian H over 8 years
    The link for "your Sonar server configured..." seems to be broken. docs.sonarqube.org/display/PLUG/… is probably where it went.
  • Fabrice - SonarSource Team
    Fabrice - SonarSource Team over 8 years
    @IanH Thanks for the notification, I've updated the links!
  • Jhack
    Jhack over 8 years
    Now the Post Build Action is no longer recommended: "It is no longer recommended to use SonarQube maven builder. It is preferable to set up SonarQube in the build environment and use a standard Jenkins maven target.". So, it seems that you have to add a "sonar-project.properties" configuration file to every single job you want to analyze, using a Pre or a Post Build Step. It is not clear how to simply configure many jobs.
  • Nymeria
    Nymeria over 8 years
    Hello, If I'm not using maven, should sonar runner be on the same server than jenkins ?
  • asmaier
    asmaier about 8 years
    The first link is dead again, I guess the correct one is now this: docs.sonarqube.org/display/SONAR/…