1.在 web 的那个模块 的 pom 文件中加入如下代码
<!-- 配置jetty 插件启动 -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.6.v20170531</version>
<configuration>
<!-- 如果这里配置了会使用这里的端口 -->
<!-- <httpConnector>
<port>80</port>
</httpConnector>-->
<!-- 这里配置访问德项目名称 -->
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
<stopKey>shutdown</stopKey>
<stopPort>9966</stopPort>
</configuration>
</plugin>
2.
working directory是项目地址,如果是多模块的maven 项目,使用的是 web 的那个模块,
command line如果仅仅写 jetty:run, 启动的端口是默认的8080, 后面指定端口的话就会按指定端口来启动