First, most engineers who use Maven choose Jetty to run web projects, but I do not like this. I like tomcat to run web projects and feel like updating source files, it is much better than jetty and can accelerate development.
The Maven Tomcat solution in eclipse is as follows:
1. Download tomcatplugin:
: Http://www.eclipsetotale.com/tomcatPlugin.html
2. Install atatplugin:
Decompress tomcatpluginv31.zip
Copy the com. sysdeo. Eclipse. tomcat_3.1 folder in the decompressed directory to the Plugins directory in the eclipse installation directory, that is, E:/Eclipse/plugins.
Start eclipse. After it is started, you will see a drop-down Tomcat option in your menu, click the window> preferences, and click tomcat in the left Tree, set tomcat version to version 5.x, set Tomcat root directory to E:/tomcat, click tomcat-> JVM setting on the left Tree, and set JRE to jdk1.6.0 _ 21
3. Add devloader. Jar
Copy devloader.zip under eclipse_home/dropins/[tomcatplugin_home.zip to [tomcat_home]/lib, and change the suffix to jar.
4. Specify m2_pepo
Right-click [project] -- properties -- libraries and click Add variable to add the environment variable name: m2_repo, path: D:/. m2/Repository
5. Configure Tomcat and Maven Project Association
Right-click [project] -- properties -- tomcat, "is a tomcat project" check box, context name: "/[projectname]", subdirectory to set as Web application root select the webapp directory of the current project; then click the devloader classpath tab active devloader check box, all the packages used below are also selected, but test items must be excluded, such: /[project]/target/test-classes cannot be selected. Otherwise, an error is returned.
6. Now the environment is ready. Click the Tomcat icon to start the project!
7. directly modify the source files in the maven project. The corresponding JSP/html files will be directly updated.