Let's explore the steps of Eclipse to build a MAVEN project today
One. Build a Maven project,
1. Locate file, click
2. Pop-up window, then click New
3. Pop-up window, click Other
4. Enter Maven, find MAVEN project, then click Next
5. Direct Click Next
6. Locate, double-click to select Maven-archetype-webapp
7. Enter the group ID and artifact ID, this is random input, no requirements, the package will be automatically generated, click Finish
8. Enter the group ID and artifact ID, this is the random input, no requirements, the package will be automatically generated, click Finish.
9. When you click Finis, you can build good one maven project.
10. The project column will have a MAVEN project that we just built, and the Java View project structure is as follows:
11. At this time, we will see there is no relationship between errors. Right-click Project, build path, Configure build path ...
12. Drop two wrong source folder on source
13. Click on the Add Folder ... click Create New Folder ... Add Src/main/java, Src/test/java and Src/test/resources
A similar step, the final structure is
Then OK, maybe one more ...
You can do it.
14. 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.
Then, choose this
OK.
15. Adjust the display order of the folder in order and export
16. 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.8]
And then what
And then what?
and then again.
At last
17. 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
However, we do not need to do this step, because the project we built has automatically converted us into a Dynamic Web project ....
18. Click Deployment Assembly on the left to delete the two test folder that you do not need to deploy
That's all you got.
19. The project we are creating now has errors because we are missing the jar package we need and we are going to configure the jar's coordinates in Pom.xml
This is missing the jar we need, we now configure, but how to match, I do not say from which official website downloaded, but the default is Apache official website download, you can also download from other official website.
If you want to download from other official website, you need to configure some things in Setting.xml.
This is the default, then you can change the path on it ....
So my code for the Pom.xml fake is:
<!--Java EE API-- <dependency> <groupId>javaee</groupId> <artifactId> Javaee-api</artifactid> <version>5</version> </dependency>
At this time, no error. Look
By this point it's 95%, we're going to run the project, so we're going to configure the Tomcat service and restart the service.
How does it start?
20. Configure the service, if there is no tamcat, you have to add up
And then what
21. You may not see the Tomact service ...
And then what
And then, look.
Notice that you have to add your own project here.
And then what?
Now you can start the service, La La la, la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la la La. It's been so arduous.
But I am so happy that I can share my own things with you ...
Eclipse builds maven Prooject (finally)