Springboot项目 Jenkins/Maven 分离Jar部署

项目配置


org.springframework.boot
spring-boot-maven-plugin

    
    xxx.xxx.RestApplication
    
        
            nothing
            nothing
        
    


    
        
            repackage
        
    




org.apache.maven.plugins
maven-dependency-plugin

    
        copy-dependencies
        package
        
            copy-dependencies
        
        
            
            ${project.build.directory}/lib
            false
            false
            true
            provided
        
    


启动脚本, 全部使用绝对路径

stop.sh
PID=$(ps -ef|grep jar文件名|grep -v grep|awk '{print $2}')
if [ -z $PID ]; then
    echo "process not exist"
    exit
else
    echo "process id: $PID"
    kill -9 ${PID}
    echo "process killed"
fi
start.sh
/xxxx/xxxxx/stop.sh
nohup java -jar -Xms512M -Xmx2048M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./dump -XX:+UseConcMarkSweepGC -Djava.ext.dirs=/xxxx/xxxxx/lib -Dspring.profiles.active=dev /xxxx/xxxxx/xxxxx-1.0.0.jar > /xxxx/xxxxx/out.log 2>&1 &

Jenkins配置

1632721432(1).png

你可能感兴趣的:(Springboot项目 Jenkins/Maven 分离Jar部署)