Jenkins + maven + git + sonar system continuous integration & code Test Management, jenkinsmaven
Jenkins + maven + git + sonar system continuous integration & code Test Management
Install JenkinsJenkins is a Java-based continuous integration tool used to monitor continuous repetitive work. features include: 1. Continuous software version release/test projects. 2. Monitor the execution of external calls.
1. download the latest version (a war file ). Jenkins Official Website: http://Jenkins-ci.org/
2. run java-jar jenkins. war (jenkins uses the embedded jetty service by default and can be deployed in other containers .)
(The default port is port 8080. You can use java-jar jenkins. war -- httpPort = 8088 as the listening port for the startup Item .)
Note: Jenkins needs to run Java 5 or a later version.
Basic Jenkins Configuration
System settings: Choose Manage Jenkins-> Configure System
Set the Maven configuration file path
Jenkins uses the svn management project by default. To use git, you need to install the git plug-in. Manage Jenkins-Manage Plugins-Available-Git plugins and click Install. Then return to the system management page to set some git parameters.
Sonar Installation
Download the latest version of http://www.sonarqube.org/
Sonar installation requires JDK or above & Maven installation (sonar uses H2 embedded database by default, but mysql and other databases are recommended for specific use)
Sonar Data Source Configuration
Change.../sonarqube-4.5.1/conf/sonar. properties
Set the properties File
Sonar. jdbc. username = database username
Sonar. jdbc. password = Database password
Set database links
Sonar. jdbc. url = jdbc: mysql: // localhost: 3306/sonar? UseUnicode = true & characterEncoding = utf8 & rewriteBatchedStatements = true & useConfigs =
Set link pool
Sonar. jdbc. maxActive = 20
Sonar. jdbc. maxIdle = 5
Sonar. jdbc. minIdle = 2
Sonar. jdbc. maxWait = 5000
Sonar. jdbc. minEvictableIdleTimeMillis = 600000
Sonar. jdbc. timeBetweenEvictionRunsMillis = 30000
Create a sonar DB in the mysql database
Start sonar:./sonar. sh start (the default start port is 9000. Open http: // localhost: 9000 in the browser)
Sonar Project Test
Configure sonar maven configuration in the project that requires sonar statistics Test
<Properties> <! -- Sonar config --> <sonar. jdbc. url> jdbc: mysql: // localhost: 3306/sonar? UseUnicode = true & characterEncoding = utf8 & autoReconnect = true </sonar. jdbc. url> <sonar. jdbc. driver> com. mysql. jdbc. driver </sonar. jdbc. driver> <sonar. jdbc. username> username </sonar. jdbc. username> <sonar. jdbc. password> passwd </sonar. jdbc. password> <sonar. host. url> http: // localhost: 9000 </sonar. host. url> <sonar. scm. enabled> true </sonar. scm. enabled> <sonar. core. codeCoveragePlugin> cobertura </sonar. core. codeCoverag EPlugin> <sonar. cobertura. maxmen> 1024 M </sonar. cobertura. maxmen> <sonar. skippedModules> <! -- Unneeded package --> </sonar. skippedModules> </properties>
Use mvn sonar: sonar to call the sonar program for test in the corresponding project directory.
Jenkins Sonar Configuration
To set sonar Configuration Management on Jenkins, you must first install the sonar plug-in. Choose Manage Jenkins-> Manage Plugins-> Available-> Sonar Plugin and click Install.
Then configure some basic sonar parameters in the system settings.
Jenkins Project Management Configuration
Jenkins project configuration management
Sonar Project Test Management
Start the Project build
View the sonar Test of the project