Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to integrate SonarQube with Jenkins

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "Jenkins how to integrate SonarQube", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Jenkins how to integrate SonarQube" this article.

Jenkins integrates SonarQube Scanner1. Install Jenkins

Download the installation package. Here we download the war package: https://jenkins.io/download/

There are two ways to run jenkins.war:

First: put it in tomcat to run (put it in the webapps directory, start tomcat)

The second kind: execute java-jar jenkins.war-httpPort=8080 directly

Third: Docker deployment:

# View jenkins version command docker search jenkins# pull image command (not marked for the latest) the mount directory of docker pull jenkins# article is the permission to modify mkdir / home/jenkins# under home (1000 home is UID and GID) key: this directory needs to set permissions Otherwise, boot container error permissions chown-R 1000 home/jenkins:/var/jenkins_home 1000 / home/jenkins/# use image boot container command docker run-d-p 8000 docker run 8080-p 50000 docker run 50000-v / boot-- name jenkins-- privileged=true-u root jenkins

Https://jenkins.io/doc/pipeline/tour/getting-started/

Here we choose the first way.

Start tomcat (bin/startup.sh) to access http://localhost:8080/jenkins/

The Jenkins installation is complete.

two。 Install the SonarQube Scanner plug-in

Configure SonarQube after installation is complete

Generate a Token in SonarQube (PS: use token instead of entering a user name and password). Under "my account" and "Security" under the user's profile picture, generate token.

Then configure the address in Jenkins to connect to the sonarqube server. The token used here is the token you just created in sonarqube.

Set the token of SonarQube servers in the system configuration in Jenkins

Install SonarQube servers in the global configuration in Jenkins

3. Create a task

Configure the configuration of SVN or GIT

Most importantly, configure SonarQube analysis properties

You can write it separately in a configuration file (sonar-project.properties), or you can write it every time like this.

Sonar.projectKey=$ {JOB_NAME} sonar.sources=.sonar.projectName=$ {JOB_NAME} sonar.projectVersion=$ {BUILD_VERSION} sonar.language=javasonar.sourceEncoding=UTF-8sonar.sources=$WORKSPACEsonar.java.binaries=$WORKSPACE above is all the content of this article "how Jenkins integrates SonarQube". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report