源码管理-配置SVN信息
![在这里插入图片描述](http://www.kaotop.com/file/tupian/20220506/20201005150042508.png?x-oss-process=image/watermark,typ 《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》无偿开源 威信搜索公众号【编程进阶路】 e_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2wxMDI4Mzg2ODA0,size_16,color_FFFFFF,t_70#pic_center)
[](()配置Pre Steps [](()配置Post Steps配置完成后保存。
[](()构建项目回到主页,点击立即构建项目按钮,如下图:
可看到页面上出现对maven_test的构建进度条,点击进度条即可进入日志输出页面,如下图:
输出如下日志,则代表构建并部署到tomcat成功。
[](()tomcat.sh脚本最后,我们给出tomcat.sh脚本的内容,如下所示。
#!/bin/sh
java env service nameSERVICE_NAME=tomcat_service
case “$1” in
start)
/usr/local/tomcat/test-tomcat-10000/bin/startup.sh
;;
stop)
sleep 5
edu-service-aa.jar edu-service-aa-bb.jarP_ID=ps -ef | grep -w "test-tomcat-10000" | grep -v "grep" | awk '{print }'
if [ “$P_ID” == “” ]; then
echo “=== $SERVICE_NAME process not exists or stop success”
else
echo “=== S E R V I C E N A M E p r o c e s s p i d i s : SERVICE_NAME process pid is: SERVICENAMEprocesspidis:P_ID”
echo “=== begin kill S E R V I C E N A M E p r o c e s s , p i d i s : SERVICE_NAME process, pid is: SERVICENAMEprocess,pidis:P_ID”
kill $P_ID
fi
;;
restart)
$0 stop
sleep 2
$0 start
echo “=== restart $SERVICE_NAME”
;;
*)
restart$0 stop
sleep 2
$0 start
;;
esac
exit 0
[](()构建Java项目
Jenkins构建Jar包发布到远程服务器和构建War包发布到远程服务器配置基本一致,只是Post Steps配置稍有不同。
[](()配置Post Steps配置Jar包发布到远程服务器的Post Steps配置如下:
[](()构建项目 [](()account-server.sh脚本最后,我们也给出account-server.sh脚本的内容,如下所示。
#!/bin/sh
java envexport JAVA_HOME=/usr/local/jdk/jdk1.8.0_144
export JRE_HOME=$JAVA_HOME/jre
service nameAPP_NAME=account
SERVICE_DIR=/usr/local/dubbo-server/$APP_NAME
SERVICE_NAME=medcare-dubbo-$APP_NAME
JAR_NAME=$SERVICE_NAME.jar
PID=$SERVICE_NAME.pid
cd $SERVICE_DIR
case “$1” in
start)
nohup $JRE_HOME/bin/java -Xms256m -Xmx512m -jar $JAR_NAME >/dev/null 2>&1 &
echo $! > S E R V I C E D I R / SERVICE_DIR/ SERVICEDIR/PID
echo “=== start $SERVICE_NAME”
;;
stop)
kill cat $SERVICE_DIR/$PID
rm -rf S E R V I C E D I R / SERVICE_DIR/ SERVICEDIR/PID
echo “=== stop $SERVICE_NAME”
sleep 5
edu-service-aa.jar edu-service-aa-bb.jarP_ID=ps -ef | grep -w "$SERVICE_NAME" | grep -v "grep" | awk '{print }'
if [ “$P_ID” == “” ]; then
echo “=== $SERVICE_NAME process not exists or stop success”
else
echo “=== S E R V I C E N A M E p r o c e s s p i d i s : SERVICE_NAME process pid is: SERVICENAMEprocesspidis:P_ID”
echo “=== begin kill S E R V I C E N A M E p r o c e s s , p i d i s : SERVICE_NAME process, pid is: SERVICENAMEprocess,pidis:P_ID”
kill -9 $P_ID
fi
;;
restart)
$0 stop
sleep 2
$0 start
echo “=== restart $SERVICE_NAME”
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)