How to stop tomcat 7 with maven in eclipse

末鹿安然 提交于 2019-12-24 00:49:26

问题


When I run my maven web project in eclipse. I go to pom.xml, right click on the file and
1. Maven Clean
2. Build Resources
3. Maven Build ..

Then I type tomcat7:run (for tomcat 7) for tomcat 6 , tomcat:run in the tomcat goals field in eclipse . It just starts. But I want to know how
1. To stop it
2. Rebuild the source and redeploy

in elipse or any other quick easy step. Isn't there any way to do all stuff to start the tomcat instead of repeating fore said steps(maven clean.. building resource.. again type tomcat7:run ... ) in eclipse.


回答1:


Can you try right click on pom.xml > Run As > Maven Build... Define here in the Goals section all your commands, something like: clean install tomcat7:run

My recommendation is to check skip tests for faster start up time, you can add extra paramenters like -Denvironment=qa if needed or VM arguments (from the JRE tab) like -Xmx2048m -Xms256m

Also, put a name to the configuration since you will be able to Run it again with a simple click or you could copy the .launch file eclipse generates into your application and commit it.

To stop the server just click the red square from the console view.

Hope it helps.




回答2:


Following worked for me:

mvn tomcat7:shutdown

http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/shutdown-mojo.html




回答3:


You can use JRebel to hot-deploy your changes, no need to stop/start the app. In IntelliJ use Ctrl+Shift+F9 to recompile and hot-deploty current changes. Installing JRebel takes 5 minutes, and running app under JRebel is relally easy:

mvn <your usual parameteres here> -Djrebel.

If you search around, you can get JRebel for free.

Also, nothing stops you from running your maven application in a command line. Then stopping your app is as easy as hitting Ctrl+C.

You can also try maven tomcat shutdown plugin: http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/shutdown-mojo.html.




回答4:


I use JBoss Tools for managing Containers from Eclipse.




回答5:


Just close the window for eclipse if the red square from the console view is not available.



来源:https://stackoverflow.com/questions/25592039/how-to-stop-tomcat-7-with-maven-in-eclipse

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