MAVEN configuration-Create Web projects with MAVEN support for Tomcat directory deployment
First, create a MAVEN Web project operation steps:
1. Create a new dynamic Web Project.
2, set the Java source code directory for Scr/main/java, keep and Maven source code directory one to.
3. Set the Web content directory to Src/main/webapp. Also in order to maintain and Maven directory one to.
4. After the creation is complete, right-click on the project selection maven->enable Dependency Management, using maven to manage jar dependencies.
5. Set the POM and set the package type to war.
6. Add Maven dependencies to the Java EE Module dependencies.
7. Set the compilation path for Java code. The compilation path is set to Webapp/web-inf/classes to support directory deployment.
8. Set the compiler version.
Second, create a new Tomcat run server. Do not select the deployed project during the new process, and when you are finished, double-click the server to add it in the configuration to make the directory deployment. However, the jar package below Lib is not yet under Webapp/web-inf/lib. The default is to the/target/ecop_m2-1.0.1-snapshot/web-inf/lib directory.
Third, let Maven package, a copy of the jar to Webapp/web-inf/lib.
1, double hit open pom.xml file, switch to Pom.xml card. Add Maven dependency plug-ins and set up a copy of the jar to the Web at the time of packaging, so Tomcat can find the project jar when it starts.
The code is as follows:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/webapp/WEB-INF/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins> (2010-06-15 15:45:03) reprinted
First, create a MAVEN Web project operation steps:
1. Create a new dynamic Web Project.
2, set the Java source code directory for Scr/main/java, keep and Maven source code directory one to.
3. Set the Web content directory to Src/main/webapp. Also in order to maintain and Maven directory one to.
4. After the creation is complete, right-click on the project selection maven->enable Dependency Management, using maven to manage jar dependencies.
5. Set the POM and set the package type to war.
6. Add Maven dependencies to the Java EE Module dependencies.
7. Set the compilation path for Java code. The compilation path is set to Webapp/web-inf/classes to support directory deployment.
8. Set the compiler version.
Second, create a new Tomcat run server. Do not select the deployed project during the new process, and when you are finished, double-click the server to add it in the configuration to make the directory deployment. However, the jar package below Lib is not yet under Webapp/web-inf/lib. The default is to the/target/ecop_m2-1.0.1-snapshot/web-inf/lib directory.
Third, let Maven package, a copy of the jar to Webapp/web-inf/lib.
1, double hit open pom.xml file, switch to Pom.xml card. Add Maven dependency plug-ins and set up a copy of the jar to the Web at the time of packaging, so Tomcat can find the project jar when it starts.
The code is as follows:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/webapp/WEB-INF/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>