源码管理
选择 “git”, Repository URL填写你的git地址,并配置对应的key,大家最好事前先在jenkins这台机器上能够直接远程git操作私有仓库
构建触发器、构建环境、Pre Steps保持默认
 
Jenkins部署java项目实例02
 
Build
“Root POM”为pom.xml, Goals and options 填写 clean install -D maven.test.skip=true
Post Steps、构建设置保持默认
 
Jenkins部署java项目实例02
Jenkins部署java项目实例02
 
构建  执行 shell
Jenkins部署java项目实例02
 
 
jenkins 上 分发脚本内容
[root@jenkins-ansible-jumpserver sh]# cat deploy_weifeng_dev.sh 
#!/bin/bash


# kill tomcat进程
tomcat_fashion_bi_dev_pid=`ps aux|grep weifeng|grep -v "grep"|awk '{print $2}'`

if [ "$tomcat_fashion_bi_dev_pid" ];then
    ps aux|grep weifeng|grep -v "grep"|awk '{print $2}'|xargs kill -9 
    echo "old tomcat weifeng dev  process  is killed"
fi


rm -rf  /home/deploy/weifeng/dev/deploy_files/*

echo "delete old  project files /home/deploy/weifeng/dev/deploy_files"


#解压war包到 代码执行地方

cd /home/deploy/weifeng/dev/
unzip -oq deepfashion-fashionbi.war -d /home/deploy/weifeng/dev/deploy_files/


#重启tomcat
cd /home/deploy/tomcat_weifeng_dev/bin
sh startup.sh

sleep 5
tomcatport=` netstat -lntp|grep "8080"|awk '{print $4}'|awk -F":" '{print $2}'`
echo $tomcatport

if [ "$tomcatport" ];then
          echo -e "\033[32m[ tomcat weifeng started success on dev env !  ]\033[0m"
fi

  

 
 

相关文章:

  • 2022-12-23
  • 2021-08-27
  • 2021-06-18
  • 2021-06-14
  • 2022-01-12
  • 2021-07-21
  • 2021-07-12
  • 2022-01-16
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-11-21
  • 2021-10-11
  • 2021-06-22
  • 2022-01-10
相关资源
相似解决方案