jetty插件配置如下
<!-- -jetty插件 -->
<!-- 添加此插件以便启动jetty -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.8.v20150217</version>
<configuration>
<httpConnector>
<port>8081</port>
</httpConnector>
<stopKey>shutdown</stopKey>
<stopPort>9966</stopPort>
<scanIntervalSeconds>2</scanIntervalSeconds>
<reload>manual</reload>
<dumpOnStart>true</dumpOnStart>
<webApp>
<!--<contextPath>/${project.artifactId}</contextPath> -->
<contextPath>/</contextPath>
<defaultsDescriptor>src/main/conf/webdefault.xml</defaultsDescriptor>
</webApp>
<requestLog implementation="org.eclipse.jetty.server.NCSARequestLog">
<filename>target/access-yyyy_mm_dd.log</filename>
<filenameDateFormat>yyyy_MM_dd</filenameDateFormat>
<logDateFormat>yyyy-MM-dd HH:mm:ss</logDateFormat>
<logTimeZone>GMT+8:00</logTimeZone>
<append>true</append>
<logServer>true</logServer>
<retainDays>120</retainDays>
<logCookies>true</logCookies>
</requestLog>
</configuration>
</plugin>
或者
打印日志
[INFO] webAppSourceDirectory E:\gls\GLS-APP\GlsAPI\src\main\webapp does not exist. Trying E:\gls\GLS-APP\GlsAPI\target\webapp-tmp
原来jetty插件配置webAppSourceDirectory默认是\src\main\webapp,而我项目静态资源路径是webroot/
加上配置 <webAppSourceDirectory>webroot/</webAppSourceDirectory>,成功