参考:http://czj4451.iteye.com/blog/1942437
准备工作:
在pom.xml中配置jetty插件:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>8.1.16.v20140903</version>
<configuration>
<webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
<scanIntervalSeconds>6</scanIntervalSeconds>
<contextPath>/</contextPath>
<webDefaultXml>jetty.xml</webDefaultXml>
<jettyEnvXml>jetty-env.xml</jettyEnvXml>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<headerBufferSize>80000</headerBufferSize>
</connector>
</connectors>
<stopKey>stop</stopKey>
<stopPort>8089</stopPort>
</configuration>
</plugin>
Jetty实战之 maven+嵌入式Jetty运行web app: