I. Creating a project
Create a project with Maven in 1.Eclipse
In the image above, next
2. Continue Next
3. After selecting Maven-archetype-webapp, next
4. Fill in the corresponding information, GroupID and Artifactid can be arbitrarily taken, groupid generally divided into several paragraphs, here only two paragraphs, the first paragraph is the domain, the second paragraph is the company name. Domain is also divided into org, COM, CN and so many, including Org is not a profit organization, COM for business organizations. Example of an Apache Tomcat project: The project's GroupID is Org.apache, its domain is org (because Tomcat is a nonprofit project), and the company name is Apache,artigactid is the name of the project that was created. The package is created by default and can be used without writing
5. After creating the project, the directory is as follows:
At this point, the project has been created, but the configuration below.
two. Project configuration
1. Add Source Folder
MAVEN requires that you create the following source Folder
Src/main/resources
Src/main/java
Src/test/resources
Src/test/java
Add the above source Folder
The following directories are created:
2. Configure the Build Path
3. Set the output of the 4 Folders folder, double-click Modify
Modify the output path separately to
Src/main/resources Correspondence Target/classes
Src/main/java Correspondence Target/classes
Src/test/resources Correspondence Target/test-classes
Src/test/java Correspondence Target/test-classes
4. The following image is modified (new eclipse may vary)
5. Setting libraries
6. After configuring the build path, the directory is as follows:
7. Convert the project to dynamic WEB project
Right-click Properties on the Project
Select Project Facets on the left and click Convert faceted from on the right
8. Modify Java as the JDK for your current project, click Runtimes to tick the tomcat version you want to use, add the dynamic Web Module, and then click the further Configuration available link: (here if there is no link , you can cancel dynamic check click Appply and then open this screen again to select)
9. Modify the content directory to Src/main/webapp, click OK:
10. After setting content Directory,ok, click the previous interface OK again to complete the conversion to dynamic WEB project
11. Set up Deployment assemblies (Web Deployment Assembly)
Right-click on the project, select Properties, select Deployment Assembly on the left
12. Set the file publishing path at deployment time
1, we delete the two items of test, because tests are used for testing and do not need to be deployed.
2, set the Maven jar package to be published under Lib.
ADD, Java Build Path Entries, Maven Dependencies, Finish
After the setup is complete, as shown
After OK, the Web project is created and the directory organization is shown
After running the access works successfully.