In the project, you need to integrate the server into Maven for convenience of debugging,
Integration as plugin:
[Html]
<Plugin>
<GroupId> org. mortbay. jetty </groupId>
<ArtifactId> jetty-maven-plugin </artifactId>
<Configuration>
<ScanIntervalSeconds> 10 </scanIntervalSeconds>
<WebAppConfig>
<ContextPath>/web </contextPath>
<! -- Additional ClassPath configuration, N-plus properties files, etc. -->
<ExtraClasspath> properties </extraClasspath>
</WebAppConfig>
<ContextHandlers>
<! -- Sub-Project dependency, or add multiple projects to the jetty running environment -->
<ContextHandler implementation = "org. eclipse. jetty. webapp. WebAppContext">
<War> ../subweb/src/main/webapp </war>
<ContextPath>/subweb </contextPath>
</ContextHandler>
</ContextHandlers>
<SystemProperties>
<SystemProperty>
<Name> catalina. base </name>
<Value >$ {basedir}/target </>
</SystemProperty>
</SystemProperties>
<Connectors>
<Connector implementation = "org. eclipse. jetty. server. nio. SelectChannelConnector">
<Port> 8080 </port>
<MaxIdleTime> 400000 </maxIdleTime>
</Connector>
</Connectors>
</Configuration>
</Plugin>
Run mvn jetty: run directly under the project
Integrate as Maven parameters:
[Html]
<Profiles>
<Profile>
<Id> run-jetty </id>
<Build>
<Plugins>
<Plugin>
<GroupId> org. mortbay. jetty </groupId>
<ArtifactId> jetty-maven-plugin </artifactId>
<Configuration>
<ScanIntervalSeconds> 10 </scanIntervalSeconds>
<WebAppConfig>
<ContextPath>/web </contextPath>
<ExtraClasspath> properties </extraClasspath>
</WebAppConfig>
<ContextHandlers>
<ContextHandler implementation = "org. eclipse. jetty. webapp. WebAppContext">
<War> ../subweb/src/main/webapp </war>
<ContextPath>/subweb </contextPath>
</ContextHandler>
</ContextHandlers>
<SystemProperties>
<SystemProperty>
<Name> catalina. base </name>
<Value >$ {basedir}/target </>
</SystemProperty>
</SystemProperties>
<Connectors>
<Connector implementation = "org. eclipse. jetty. server. nio. SelectChannelConnector">
<Port> 8080 </port>
<MaxIdleTime> 400000 </maxIdleTime>
</Connector>
</Connectors>
</Configuration>
</Plugin>
</Plugins>
</Build>
<Profile>
<Profiles> www.2cto.com
Run mvn-DskipTests = true clean test-Prun-jetty in the project
Http://www.devhup.com /? P = 140
Author: devhubs