在maven中內建
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.8.v20150217</version>
<configuration>
<stopKey>shutdown</stopKey>
<stopPort>9966</stopPort>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9999</port>
</connector>
</connectors>
<scanIntervalSeconds>2</scanIntervalSeconds>
<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>
<webApp>
<contextPath>/</contextPath>
</webApp>
</configuration>
</plugin>
啟動的時候指定端口
1、長期使用jetty運作項目需要修改指定的端口。每次記不住。每次需要去網上搜;
2、指令 jetty:run -Djetty.port=8099