How to start grunt server in Jenkins correct

扶醉桌前 提交于 2019-12-25 04:02:44

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!