How to do it...

  1. Go to the Build section and select Execute SonarQube Scanner:
  1. You can provide the location of sonar-project.properties or provide details directly for static code analysis.
# Required metadata 
sonar.projectKey=SonarHTMLCSSJS 
sonar.projectName=Simple HTML CSS JS project analyzed with the SonarQube 
sonar.projectVersion=1.0 
# Comma-separated paths to directories with sources (required) 
sonar.sources=. 
# Encoding of the source files 
sonar.sourceEncoding=UTF-8 
  1. sonar.sources is the main property for static code analysis. With this property, you inform SonarQube which directory needs to be analyzed:
  1. Click on Save.
  2. Go to Jenkins ...

Get Jenkins 2.x Continuous Integration Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.