The steps are as follows:
- Ctrl + N to bring up the new window, double-click to select Maven Project
- Click Next directly
- Double-click to select Maven-archetype-webapp (this list needs to load for some time)
- Enter the group ID and artifact ID (project name) according to your personal situation, the package will be generated automatically, click Finish
The project structure under Java view is as follows
- Right-click Project, build path, Configure build path ...
- Down two wrong source folder on source
- Click on Add Folder ... click Create New Folder ... Add Src/main/java, Src/test/java and Src/test/resources
- Double-click the output folder under Src/test/java and Src/test/resources, and set the class publishing directory for the test code compilation to Target/test-classes. In order to not be mixed with the official code compiled files, the official code publishing directory using the default target/classes.
- Adjust the order of folder display in order and export
- Double-click in libraries to replace the default JRE with your own JRE, as I am replacing the JRE system library [j2se-1.5] with the JRE system library [jdk1.6]
- Convert to a Dynamic Web project so that Tomcat recognizes
Click on the left side of Project Facets, on the right, select dynamic Web Module-----set version to 2.5 (default 3.0 for Java7), and temporarily do not click OK
- Click on the further configuration available ..... set Web. XML in the directory of Src/main/webapp, Apply
- Click Deployment Assembly on the left to delete the two test folder that you do not need to deploy
- Set up a package that releases Maven dependencies simultaneously when publishing
Click Add, double-click Java Build Path Entries, double-click Maven Dependencies-OK
Final Project Catalog effect
- Deploy to Tomcat (if not clearly available on this site), visit http://localhost:8080/example/, and appear Hello world! Prove that you have succeeded!
If this content is helpful to you, welcome to click on the form of ads to support us, but please do not more than once a day, or may be identified as malicious click, resulting in the number.
MAVEN Create Web Project