背景:今天给公司同事培训Jenkins+Git+maven持续集成环境搭建,现在将资料分享给大家
1、下载tomcat,下载jenkins.war,
地址分别为:
https://www.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz
http://mirrors.jenkins-ci.org/war/latest/jenkins.war
http://www.apache.org/dist/maven/maven-3/3.2.1/binaries/apache-maven-3.2.1-bin.tar.gz
2 , 把jenkins.war放到webapp中,启动tomcat,解压maven到本地文件系统
3.下载jenkins插件,如下插件安装
Jenkins -> manager jenkins ->Manager Plugins
4.配置maven
5.配置Git
1)配置git路径
(注:)上面git地址有时候也有可能需要配置到C:\Program Files (x86)\Git\cmd\git.exe, 不行的时候多试试便是
2)配置git plugin
(注:4、5都是在Jenkins -> manager jenkins -> configure System 路径下)
6.新建Job
1)配置git信息
2)指定pom.xml 位置
7:点Save ,点build now
8:开开心心看结果
------------------------------------------------------- T E S T S ------------------------------------------------------- Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [JENKINS] Recording test results [INFO] [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ testmaven --- [INFO] Building jar: C:\Users\pzhang4\.jenkins\jobs\auto\workspace\testmaven\target\testmaven-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ testmaven --- [INFO] Installing C:\Users\pzhang4\.jenkins\jobs\auto\workspace\testmaven\target\testmaven-0.0.1-SNAPSHOT.jar to C:\Users\pzhang4\.m2\repository\com\testmaven\testmaven\0.0.1-SNAPSHOT\testmaven-0.0.1-SNAPSHOT.jar [INFO] Installing C:\Users\pzhang4\.jenkins\jobs\auto\workspace\testmaven\pom.xml to C:\Users\pzhang4\.m2\repository\com\testmaven\testmaven\0.0.1-SNAPSHOT\testmaven-0.0.1-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.808s [INFO] Finished at: Fri Jun 13 03:05:18 BRT 2014 [INFO] Final Memory: 16M/223M [INFO] ------------------------------------------------------------------------ Waiting for Jenkins to finish collecting data [JENKINS] Archiving C:\Users\pzhang4\.jenkins\jobs\auto\workspace\testmaven\pom.xml to com.testmaven/testmaven/0.0.1-SNAPSHOT/testmaven-0.0.1-SNAPSHOT.pom [JENKINS] Archiving C:\Users\pzhang4\.jenkins\jobs\auto\workspace\testmaven\target\testmaven-0.0.1-SNAPSHOT.jar to com.testmaven/testmaven/0.0.1-SNAPSHOT/testmaven-0.0.1-SNAPSHOT.jar channel stopped Finished: SUCCESS