First, create a MAVEN2 project. This will not be said.
Two. In src/main/resources, two documents can be placed on the internet to go down.
Jetty-env.xml
Webdefault.xml
Three. Add the following content to the Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<jettyEnvXml>src/main/resources/jetty-env.xml</jettyEnvXml>
<webAppConfig>
<contextPath>/</contextPath>
<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
<baseResource implementation="org.mortbay.resource.ResourceCollection">
<resources>src/main/webapp</resources>
</baseResource>
</webAppConfig>
</configuration>
</plugin>
</plugins>
</build>
Four. Use Maven to automatically download the appropriate jar files, Maven-jetty-plugin and so on.
Five. Configure the operating environment
Run->external tools->external Tools Configurations
New project running environment in MAVEN build.
A. Select base directory as the current project.
B.goals:jetty:run