Eclipse creates a maven project dynamic web project (problem occurs), eclipsemaven
EClipse: Create a maven project dynamic web project
Note: Eclipse Version (Version: Mars.1 Release (4.5.1) maven Version (apache-maven-3.3.9)
1.
This is done after you have installed the maven plug-in and configured your maven environment to specify your maven local repository. The following describes how to build a maven web project.
First, click Create maven Project
2. click next.
3. Select web options
4. Create the coordinates of your project and click finish.
5. An error occurred while creating the project.
6. Right-click the project and find properties. Change jdk to your jdk.
7. removed the error and changed javaEE to 3.0, and reported the error. We will continue to solve the problem. He came to the path of our project ~
8. Find the project file
9. See the following file:
10. Modify the first file as follows:
10.1 this is the original file
The modified file is as follows:
10.2 open the second file
Modify the file as follows:
11. The web. xml file is automatically generated with 2.3. We want to replace it.
The Code is as follows:
1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <web-app version="3.0" 4 5 xmlns="http://java.sun.com/xml/ns/javaee" 6 7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 8 9 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee10 11 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">12 13 <display-name>Archetype Created Web Application</display-name>14 15 </web-app>
12. Right-click the project, close the project, and double-click the project to open it. 3.0 is automatically selected.
13. Add the following code to the pom. xml file:
The Code is as follows to facilitate copying and pasting.
1 <build> 2 3 <finalName>BQ</finalName> 4 5 <plugins> 6 7 <plugin> 8 9 <groupId>org.apache.tomcat.maven</groupId>10 11 <artifactId>tomcat7-maven-plugin</artifactId>12 13 <version>2.2</version>14 15 </plugin>16 17 </plugins>18 19 </build>
14. Run the mavenweb project under tomcat.
15. Enter the command here only use
16. The print operation is successfully controlled.
17 Access successful
If there is a problem, kill your local repository and create a new one. Because the plug-in may be downloaded to the middle of the room, and the plug-in will not be resumable, so your plug-in will report an error.