Issue
I am trying to execute Jarfile
through Jenkins
. I succeeded in creating a Jar
file through Jenkins
, but I don't know how to do it after I make it. How can I run and test a project?
Project Settings in Jenkins
init_server.sh
echo "> Check the currently running spring server pid "
CURRENT_PID=$(ps -ef | grep java | grep zzazan* | awk '{print $2}')
echo "$CURRENT_PID"
if [ -z $CURRENT_PID ]; then
echo "> No applications are currently running and will not be shut down."
else
echo "> kill -9 $CURRENT_PID"
kill -9 $CURRENT_PID
sleep 10
fi
echo "> Deploy new spring application!!" nohup java -jar /root/jenkinsproject/deploy/testjpaproject.jar >> /root/jenkinsproject/logs/springtestprojectSys.log &
NOTE: This setting was followed by a blog post, and this is the
JPA
project. Usebuild.gradle
andapplication.yml
.
Solution
You can run commands to be executed in shell. Pass the java -jar cmd in Execute Shell to run the jar file after it is created. Hope this helps!
Check this out -> https://wiki.jenkins.io/display/JENKINS/Parameterized+Build
Answered By - Mikhu Rakshit