Creating a Web project with maven in MyEclipse
Tools/Materials
- MyEclipse2014
- Maven-3.3.3
Method/Step
- 1
New--Other
- 2
1, Wizards:mvaen
2. Maven Project
3. Next
- 3
Use Default Workspace location
- 4
1, WebApp
2, Maven-archetype-webapp
3. Next
- 5
1. Enter Group Id
2. Enter Artifact Id
3. Finish
- 6
This time you will see file error, workaround
Add servlet in pom
< Dependency>
<groupid>javax.servlet</groupid>
<artifactid>javax.servlet-api</artifactid>
<version>3.0.1</ Version>
</DEPENDENCY>
Add ctrl+s save
- 7
JUnit version modification and Servlet only run when compiling and testing
<dependency>
<groupid>junit</groupid>
< Artifactid>junit</artifactid>
<VERSION>4.10</VERSION>
<scope>test</scope>
</dependency>
< Dependency>
<groupid>javax.servlet</groupid>
<artifactid>javax.servlet-api</artifactid>
<version>3.0.1</ Version>
<!--run--> only during compilation and testing;
<scope>provided</ Scope>
</dependency>
- 8
You can see that the MAVEN project is not complete
Here's how to complete a project
1. Select the item, right-click the mouse button New-->folder
Src/main/java
Src/test/java
2. Select the item, right-click New-->source Folder
Src/test/resources
- 9
Project Check Check output path
- 10
Convert to Web Project
- 11
Delete unwanted output files
- 12
Project Creation Complete
END
method to run in the jetty container
Modify Pom.xml
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
</plugin>
</plugins>
Run jetty
1. Run as--and Maven Build
Enter the local address and port in the browser
http://127.0.0.1:8080/
Creating a Web project with maven in MyEclipse