1. Create a Java project
1) File--->new--->other--->maven--->maven projet
2) Select Maven-archetype-quickstart
3 Enter the project information
4 The generated Java project package structure is as follows
5) Modify Pom.xml to specify the JDK version at compile time
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < Modelversion>4.0.0</modelversion> <groupId>cn.luxh.app</groupId> <artifactid>my-app </artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name
>my-app</name> <url>http://maven.apache.org</url> <!--specify properties--> <properties> <junit.version>4.10</junit.version> <project.build.sourceencoding>utf-8</
project.build.sourceencoding> <jdk.version>1.6</jdk.version> </properties> <build> <plugins> <!--Specify the compiled version of the JDK--> <plugin> <groupid>org.apache. Maven.plugins</groupid> <artifactid>maven-compiler-plugIn</artifactid> <version>2.5.1</version> <configuration>
<source>${jdk.version}</source> <target>${jdk.version}</target>
<showWarnings>true</showWarnings> </configuration> </plugin>
</plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope> ;test</scope> </dependency> </dependencies> </project>
2. Create a Web project
1) File--->new--->other--->maven--->maven projet
2) Select Maven-archetype-webapp
3) Fill in the project information
4 The production of the Web project package structure
4.1 Convert the project to Dynamic Web Module, right-click on the item, select Properties, then select Project Facets, then click Convert to Faceted form ...
Check dynamic Web Module, select 3.0 to support servlet3.0
Check Java, select 1.6 or higher JDK version
4.2 The tool only generates a source folder called Src/main/resource, we need to manually add Src/main/java, Src/test/java, and Src/test/resource three source folder, right-click New---->source folder on the item, and enter folder name.
4.3 Modify the source folder's compile path, enter the Java Build Bath window, double-click the output folder under each file, and specify the path.
Src/main/java and Src/main/resource specify Target/calsses,src/test/java and Src/test/resource specified target/test-classes
Select the selected allow output folders for source folders.
4.4 Configure the deployment of the program deployment Assembly, delete the test of the two items, test program released when not needed, add Maven dependency library, publishing can be published to the Lib directory, add/src/main/ WebApp is the root directory of the deployment
5) Configure TOMCAT7, publish run project