1.安裝maven helper插件,略
2.項目pom.xml文件中添加jetty插件配置
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.12.v20180830</version>
<configuration>
<httpConnector>
<!--指定端口號-->
<port>8080</port>
<idleTimeout>10000</idleTimeout>
</httpConnector>
<webApp>
<contextPath>/${project.artifactId}</contextPath>
</webApp>
</configuration>
</plugin>
</plugins>
</build>
3.run-->edit configurations,新增maven

a)在working directory 內,選擇項目路徑
b)在command line內,輸入jetty:run

c) run 或debug啟動項目,即可

