在pom.xml文件中添加如下:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<httpConnector>
<port>8082</port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
添加完成后,在maven中Download Sources and Documentation,Reimport后点击Plugins->jetty->jetty:run即可启动。
在浏览器中输入:http://localhost:8082/index.jsp