- pom.xml中增加jetty的配置
-
<properties>
<jetty-version>8.1.13.v20130916</jetty-version>
<productionMode>false</productionMode>
</properties><build>
<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <webApp> <contextPath>/</contextPath> </webApp> <stopKey>webx</stopKey> <stopKey>9999</stopKey> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8081</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <requestLog implementation="org.eclipse.jetty.server.NCSARequestLog"> <filename>target/access.log</filename> <retainDays>90</retainDays> <append>false</append> <extended>false</extended> <logTimeZone>GMT+8:00</logTimeZone> </requestLog> <systemProperties> <systemProperty> <name>productionMode</name> <value>${productionMode}</value> </systemProperty> </systemProperties> </configuration> </plugin> </plugins> <pluginManagement> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty-version}</version> </plugin> </plugins> </pluginManagement>
</build>2 idea中选择用maven启动
2、idea中选择用maven启动
3、在idea中启动
4、完成,在浏览器中输入:http://localhost:8081/xxx 即可访问了