Eclipse creates a complete example of maven project dynamic web project

1. Create a new maven project, if it is not above, please go to other to find it

2, after entering the maven project, click next




Enter two id package can not write, it will help you create a new package by default, it doesn't matter if you don't write it


A project with such a directory will be generated




Click Window - show to find the navigator


Next you need to add

src/main/java

src/test/java 

src/test/resources three folders

Right-click the project root directory and click New -> Source Folder,

Create these three folders. Note that it is not a normal Folder, but a Source Folder .

Project or file plus right-click new sourceFolder, there is no problem under normal circumstances

If the following situation occurs, it actually exists, but we can't see it








After setting it was found to be successful



2.2 Change the class path

Right-click the project, Java Build Path -> Source

There should be 4 folders below. src/main/java, src/main/resources, src/test/java, src/test/resources.

Double-click the Output folder for each folder and select the path.

src/main/java,src/main/resources,选择target/classes;

src/test/java ,src/test/resources, 选择target/test-classes;

Check Allow output folders for source folders. (if not checked)



Right click properties project Facets

I want to switch to 3.0 and find an error (I solved it here)


This is because when a new project is created

Used maven-artchetype-webapp

Because this catalog is relatively old, the servlet used is still 2.3.


Re-open the property project Facets and see that this place has been modified to 3.0; check on tomcat

项目工程创建完成

new 一个server











Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326791820&siteId=291194637