Jenkins实现自动打包发布、启动
1.下载jenkins安装包并安装2.安装常用插件如PUBLISH OVER SSH、Subversion Plug-in、Credentials Binding Plugin、Maven Integration plugin3.配置svn账号,用于拉取源码4.配置maven、JDK5.配置SSH服务器6.构建一个maven工程7.构建完成后把war包
·
1.下载jenkins安装包并安装
本例使用jenkins-2.86的windows版本
2.安装常用插件
如PUBLISH OVER SSH、Subversion Plug-in、Credentials Binding Plugin、Maven Integration plugin
3.配置svn账号,用于拉取源码
4.配置maven、JDK
5.配置SSH服务器
6.构建一个maven工程
7.构建完成后把war包发布到远程tomcat,并执行脚本重启tomcat
8.需要修改脚本为可执行脚本,否则jenkins权限不够执行shell脚本
chmod 777 ./restart.sh
restart.sh脚本,仅供参考:
export JAVA_HOME='/usr/java/jdk1.8.0'
cd `dirname $0`
curdir=`pwd`
pid=`cat catalina.pid`
echo "pid: $pid"
process=`ps -ef |grep $pid |grep java`
if [ "$process" = "" ]
then
echo "tomcat $curdir is down"
else
echo "shutdown tomcat $curdir @ $pid"
echo "kill -9 $pid"
kill -9 $pid
fi
oldwardir=`ls deploy|grep .war`
echo "deploy/${oldwardir%%.war}"
rm -rf deploy/${oldwardir%%.war}
rm -rf deploy/ROOT
echo "starting tomcat $curdir"
./bin/startup.sh
sleep 10
tail -30 logs/catalina.out
9.jenkins控制台乱码
自行百度:http://blog.csdn.net/gld824125233/article/details/52549557
更多推荐
已为社区贡献1条内容
所有评论(0)