1. New Maven Project: File->maven Project
Select Maven-webapp, once selected, the second time you create a project, you do not need to re-select.
2. Modify Project Facets
A.java change to 1.7 click on the lower right corner apply
B.dynamic Web Module Uncheck click on the lower right corner apply
C.dynamic Web Module Version switch to 3.0
D.dynamic Web Module is re-checked, further configuration available appears at this time ...
Click Enter, and modify the content directory path to Src/main/webapp
Click Apply in the lower right corner.
Note: Each step should be clicked once apply otherwise it may not be possible to find this line of blue font ha.
3. Modify the Java Build Path
A. Change the JRE in libraries to 1.7
Remove the missing in the B.source and add the Src/main/java,src/main/resources,src/test/java,src/test/resources source folder
Or:
Java resource->new Resource Folder is the same
If you created a MAVEN Web project, these four source folders are already generated by default.
C. Modify the classes file location and cancel the default. Similarly, creating a project for the second time does not require a reset
4. Modify the Java complier compile-time JDK version, consistent with the above version. are 1.7
5. Modify the Web. xml file
<? XML version= "1.0" encoding= "UTF-8" ?> < xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "http ://java.sun.com/xml/ns/javaee " xsi:schemalocation=" Http://java.sun.com/xml/ns/javaee Http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd " version=" 3.0"> </web-app>
6. Modify the Pom file, add build and dependencies
<Build> <Finalname>Name of your own project</Finalname> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>2.3.2</version> <Configuration> <Source>1.7</Source> <Target>1.7</Target> </Configuration> </plugin> </Plugins></Build>
<Dependency> <groupId>Javax.servlet</groupId> <Artifactid>Javax.servlet-api</Artifactid> <version>3.1.0</version></Dependency>
<Projectxmlns= "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>Com.test</groupId> <Artifactid>Customer</Artifactid> <version>0.0.1-snapshot</version> <Packaging>War</Packaging> <name>Customer</name> <Dependencies> <Dependency> <groupId>Javax.servlet</groupId> <Artifactid>Javax.servlet-api</Artifactid> <version>3.1.0</version> </Dependency> <Dependency> <groupId>Junit</groupId> <Artifactid>Junit</Artifactid> <version>3.8.1</version> <Scope>Test</Scope> </Dependency> </Dependencies> <Build> <Finalname>Customer</Finalname> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>2.3.2</version> <Configuration> <Source>1.7</Source> <Target>1.7</Target> </Configuration> </plugin> </Plugins> </Build></Project>
7. Compile to see if the configuration succeeds/or load into the Tomcat container and run.
The MAVEN project is ready to add code.
"Dubbo" Integration Dubbo+zookeeper+springmvc (ii)---Build MAVEN project under Windows