试了一堆插件,最后用的还是 publish over SSH
jenkins基本配置不多说了,就是配置一下git仓储,配置一下gradle执行命令
clean bootRepackage
之后执行Send build artifacts over SSH
提前配置好对应的服务器
Send build artifacts over SSH
麻烦的是执行restart.sh脚本,总是各种奇葩问题,最终结果如下
#/bin/bash pid=`ps -ef | grep spp.jar | grep -v grep | awk ‘{print $2}‘` if [ -n "$pid" ] then kill -9 $pid fi java -jar /data1/javaApp/smartPushPlatform/spp.jar --server.port=30001 > console.log &
这样基本就可以完成启动了,而且可以正常推出
编译日志如下:
[Gradle] - Launching build. [SmartPushPlatform] $ /usr/share/gradle/bin/gradle clean bootRepackage Starting a Gradle Daemon (subsequent builds will be faster) :clean :compileJavaNote: /var/lib/jenkins/workspace/SmartPushPlatform/src/main/java/com/gridsum/techpub/legal/smartpush/service/TagService.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. :processResources :classes :findMainClass :jar :bootRepackage BUILD SUCCESSFUL in 7s 6 actionable tasks: 6 executed Build step ‘Invoke Gradle script‘ changed build result to SUCCESS SSH: Connecting from host [gs-server-3602] SSH: Connecting with configuration [10.202.81.26] ... SSH: EXEC: STDOUT/STDERR from command [cd /data1/javaApp/smartPushPlatform mv SmartPushPlatform-1.1.jar spp.jar sh restart.sh] ... SSH: EXEC: completed after 200 ms SSH: Disconnecting configuration [10.202.81.26] ... SSH: Transferred 1 file(s) Finished: SUCCESS
原文地址:https://www.cnblogs.com/eviltuzki/p/8447980.html
时间: 2024-10-09 16:38:04