1> 在 Maven 工程的 pom.xml 中,添加 jetty 插件
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.5.v20170502</version>
<configuration>
<useTestClasspath>true</useTestClasspath>
<useProvidedScope>true</useProvidedScope>
<stopKey>exit</stopKey>
<stopPort>9091</stopPort>
<webAppConfig>
<jettyEnvXml>src/test/resources/jetty-env.xml</jettyEnvXml>
</webAppConfig>
</configuration>
</plugin>
2> 在pom.xml里添加这个后,右侧的 Maven Projects面板里会出现 jetty 插件,双击 jetty:run jetty:run-exploded jetty:start 就可以运行 jetty工程
3> 可以针对某个项目,定制一个运行/调试的配置,在其中的 Command line 中填入指令 : jetty:run-exploded