I'm working on a Maven project in Eclipse, where I'm using Maven (mvn install
) to create my WAR file and run it on my Tomcat server. However, every time I change my application, I have to execute mvn -o compile war:exploded
and sometimes have to restart To开发者_开发知识库mcat.
Is there any other way to simplify this long and heavy process?
You may start using:
m2e ( maven to eclipse integration ) -> http://www.eclipse.org/m2e/
Eclipse WTP ( web tools platform ) -> http://www.eclipse.org/webtools/
WTP will allow you to run Tomcat from eclipse and m2e will take care of converting your Maven build into Eclipse project and integrating it with WTP.
If you are using eclipse
then you need not to use mvn -o compile war:exploded
every time. But yes, you need to use mvn install
each time you make a change in your application.
This is what you need to do:
- Open
Server View
- Open expected tomcat server settings. A settings window for tomcat will be opened.
- Select modules tab.
- Choose
Add external web module
. An input form will be opened. - Browse to your application's
target
(generated by maven) folder and then select already exploded war directory and set it asDocument Base
- Enter
Path
as the base url for your application.
This is just one time effort.
精彩评论