使用 svn+maven+jenkins(hudson)+Publish Over SSH plugins 构建持续集成及自动远程发布体系(转)
1、安装jenkins
2、浏览器访问jenkins主页 http://192.168.0.1:8080/,点击“系统管理”
3、在插件管理中,安装Publish Over SSH插件
4、在系统设置中设置JDK,Maven,Subversion,邮件通知,Publish over SSH
JDK->填写JAVA_HOME:/usr/java/jdk1.6.0_26
Maven->选择自动安装(或设置环境变量);服务端通过编写setting.xml,让maven自动从本地Nexus库中下载依赖资源
Subversion->选择1.6
Publish over SSH->passphrase:linux登录密码
SSH Servers name : xxxx
host:192.168.0.2
user:root
remote directory: /usr/local (系统设置的远程服务器顶级目录)
5、新建一个任务(job)
丢弃旧的构建->保持构建的天数:7
源码管理->Subversion->Repository URL: http://192.168.0.1/svn/sso (源代码)
Local module directory: ./sso
Repository URL: http://192.168.0.1/svn/configure/sso (环境配置文件)
Local module directory: ./configure/sso
Check-out Strategy: svn revert before svn update
构建触发器->Poll SCM->日程表->10 8,22 * * * (早晚各构建一次)
Build->Root POM->trunk/pom-test.xml
构建后操作->SSH Servers name : xxxx
Transfers->Source files: sso/product/sso/test/sso.war
Remote directory: wars (实际为/usr/local/wars)
Exec command : kill -9 `ps aux|grep tomcat1 |grep -v grep |grep java |awk '{print $2}'`
cp /usr/local/wars/sso/product/sso/test/sso.war /usr/local/tomcat1/webapps/
/usr/local/tomcat1/bin/startup.sh (重启tomcat,可写个脚本)
保存,你懂的。
6、开启tomcat1日志监控,执行一次构建,观察构建日志,验证本次操作结果,成功。
http://www.blogjava.net/iduido/archive/2012/10/31/390565.html