jenkins 自動從svn獲取源碼經過maven打包後發佈到遠端tomcat

手動生成web的war源碼文件。
mvn archetype:generate -DgroupId=com.companyname.automobile -DartifactId=trucks -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
將生成文件夾trucksweb

而後將truck文件夾的內容上傳到svn上面,再用jenkins構建。vim

jenkins安裝插件
Deploy to container Plugin
Maven Release Plug-in Plug-in
Subversion Plug-in
Maven Integration plugintomcat

在192.168.56.20部署tomcat
vim tomcat-users.xml 設置權限
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="manager-script,manager-jmx,manager-status,manager-gui" />app

在jenkins上配置項目
一、新建job源碼管理用subversion,協商snv地址svn://192.168.56.100/sadoc以及用戶名和密碼
二、觸發器選擇定時poll SCM 內容:H/6
三、Build
Goals and options:clean install package -Dmaven.test.skip=true
四、構建設置Deploy war/ear to a container
WAR/EAR files:target/*.war
寫入tomcat用戶名和密碼以及urlwebapp

項目成功之後會就能夠經過http://192.168.56.20:8080/trucks/ 訪問部署的web了maven

相關文章
相關標籤/搜索