问题
I have job in Jenkins where i build web app and start it via command:
grunt server
but when i do this build in Jenkins dont finishing because server still running in prompt:
Running "connect:livereload" (connect) task
Started connect web server on localhost:80.
Running "open:server" (open) task
Running "watch" task
So, how can i run grunt server in Jenkins in order to server still run but build finished successfully?
回答1:
The grunt server
command usually opens a local server via node, that you can do testing on. If you used yeoman or other you want the Jenkins to run the grunt build
command.
The problem is the watch
task, it will keep running looking for file changes, and automatically update the webpage via live-reload. It's quite smart for development, but not intended for a build server.
回答2:
Solved by sending process to the background via command :
grunt server &
so jenkins finished build as succesful
回答3:
I still do have this problem and Jenkins doesn't build successfully with any of these commands:
grunt serve &
nohup grunt serve
nohup grunt serve > /dev/null 2>&1
But to kill process I execute this command before copying new files, npm install
, etc.
kill -9 $(ps -aux | grep -v "grep" | grep grunt | awk '{print $2}')
来源:https://stackoverflow.com/questions/21430364/how-to-start-grunt-server-in-jenkins-correct