In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Install and configure Jenkins.
The predecessor of Jenkins is Hudson, a scalable continuous integration engine. Mainly used for:
Continuously and automatically build / test software projects such as CruiseControl and DamageControl.
Monitor some scheduled tasks.
It has two installation methods, one is to install independently, the other is to run as a war plug-in for a Tomcat (the JDK environment is essential). First download Tomcat, extract tomcat to a directory, such as / usr/local, enter the / bin directory under tomcat, start tomcat, put the jenkins.war files into the webapps directory under tomcat, and when you start jenkins, the jenkins directory will be automatically established under the webapps directory. So when accessing the address bar, you need to add the Jenkins directory after IP, for example: http://IP/jenkins:8080.
Using the command line command Scanner and Runner to analyze the code, you need to manually download the source code folder to the server where the analysis command is located and run it manually, so the persistence analysis experience is very poor. Using Jenkins can automatically download the source code, and automatically complete the analysis, but also set up scheduled tasks to achieve fully automatic, is a necessary tool for lazy people ah!
In the following example, automatic source code analysis is performed using Git+Scanner and Git+Maven, respectively. The principle is basically the same, first there must be a code base, such as Bitbucket, then configure Git in Jenkins to automatically download the latest code from the code library, and finally call Scanner or Maven to send the code to SonarQube for analysis, and the analysis report of this project will be displayed on SonarQube.
1. Install Jenkins and Maven independently in CentOS.
Wget-O / etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo # add source rpm for Jenkins-- import https://pkg.jenkins.io/redhat/jenkins.io.key # install Key yum install jenkins for Jenkins # install Jenkins ll / usr/lib/jenkins/ # after successful installation, you can view the war package of Jenkins If you want to upgrade jenkins, just download the war package and replace it. Vim / etc/sysconfig/jenkins # configure Jenkins, default startup port 8080, if you do not need to change, the configuration file can not be changed systemctl start jenkins # start Jenkins service chkconfig jenkins on # set to boot automatically start cat / var/lib/jenkins/secrets/initialAdminPassword # display the authorization number of Admin after Jenkins installation, copy it and paste it on the web login to complete the authorization.
2. Access Jenkins by browser on other computers, access address: http:// server IP:8080, paste the copied authorization number. After the authorization is successful, set the administrator account and password, then install the default components, and finally enter the startup interface:
Download and install the sonarQube Plugin plug-in in Jenkins.
After the installation is completed, check the following figure, and Jenkins will restart automatically.
3. Configure Sonar and global configuration in Jenkins
Find the configuration item for Sonaqube in the system configuration of system Administration on the home page of Jenkins
Set global tool configuration
4. Create a new free project and configure the Scanner line configuration.
Find the Git address of the source code of the project to be analyzed in Bitbucket and copy it
Configure the source code to obtain the address in Git, and add the user name and password with the least read permission in Bitbucket to realize the function of downloading the source code from the source code database.
Build Scanner to perform code analysis
Copy the configuration file of Scanner to Analysis properties, and modify the project name, primary key and version number according to the actual needs.
Build the first code analysis immediately
View the execution process
There is an error, which conflicts with the Findbugs plug-in in SonarQubo. You need to delete this plug-in in SonarQubo, and then perform the analysis to succeed.
Successful analysis
View analysis results in SonarQube
5. Install Maven and create a new maven project for configuration
Install Maven in system Management-"Global tool Management"
Take a random name and save it.
Maven will not be installed yet. The installation of maven will only be performed when you "build now". Next, create a new maven project.
Same configuration Git
The "pom.xml" in the source directory is a configuration file generated by Maven in Eclipse, which needs to be configured in Eclipse and generated in the root directory.
Add an executive Shell
Write the following command
The first time is very slow, because you have to download the Maven installation first, and then perform code analysis, and then it will be much faster. After the construction is successful, there is a hint of SUCCESS in Console Output.
View it in sonar (this is the configured dashboard)
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.