1. Open myeclipse and select File> New> project...> Maven project.
After "Next", if you want to change the default project location, you can select "Next" in the browswe of the use default workspace location.
In this step, You must select Maven-Archetype-webapp and click Next.
Enter your group ID and artifact ID and click Finish.
Then I don't know why this failed to create project error occurs. I 've been searching for solutions online for a long time, but it doesn't matter. We have other solutions.
Now let's take a look at the project directory after the error:The generated Maven project directory is incomplete, such as our JavaCode, Our test directory, etc., are manually created, and completed:
Added the WEB Project function of myeclipse.
So far, this is just a Java normal Maven project. In this step, we need to add the WEB Project feature of myeclipse to it.
Select project --> myeclipse --> Project capabilities --> Add web project capabilites. In the pop-up window, set the parameters as follows, and then select Yes in the next pop-up window. In this way, our project is a web project (note that the project icon changes, and myeclipse automatically depends on the Jee package ).
Configure project properties to open the project properties panel--- This step is very important. It's all about configuration details.
1) Java build path
1> Source
Add src/main/Java, src/test/Java, src/test/resources as source folder. You don't need to go into details here. Just click "add folder.
Minimal "Default Output Folder" changed to "mywebapp/src/main/webapp/WEB-INF/classes" --- this is important
Modify the output directory of these source folder, where main/Java and main/resources are output to default output folder, and test/Java and test/resources are output to target/test-classes, (how to modify --- click the Output Folder under each node, and then click the edit button on the right.) The final setting result is as follows:
2> order and export
To make the display look good, you can adjust the display sequence. It is very easy to look:
2) Java compiler
Note that in the image above, my project shows that JDK is 1.4, so to change it to the version we want, we will not detail it here, it should be changed.
3) myeclipse --> Web is used to modify the web features of the configuration project, for example:
All right, a myeclipse web project + Maven webapp project will be built. The rest is to develop and debug the web in myeclipse and finally package it with Maven. Of course, you must use the maven dependency feature (directly put the jar package to be dependent on in pom. add in XML, and then refresh the project to automatically import ). The attachment is a created springmvc helloworld, which can be used as a template.