TIPS ==================
Mvn jetty: run, run automatically, use the class in/target/classes, use the webapp in src/main/webapp, and use the web. xml in src/main/webapp/WEB-INF/web. xml
After it is started, the system automatically monitors file loading changes. You can modify and test the changes in eclipse.
The following configuration can be used to automatically start and stop an integration test.
[Html] <executions>
<Execution>
<Id> start-jetty </id>
<Phase> pre-integration-test </phase> execution period>
<Goals>
<Goal> run </goal> execution target
</Goals>
<Configuration>
<ScanIntervalSeconds> 0 </scanIntervalSeconds>
<Daemon> true </daemon>
</Configuration>
</Execution>
<Execution>
<Id> stop-jetty </id>
<Phase> post-integration-test </phase>
<Goals>
<Goal> stop </goal>
</Goals>
</Execution>
</Executions>
<Executions>
<Execution>
<Id> start-jetty </id>
<Phase> pre-integration-test </phase> execution period>
<Goals>
<Goal> run </goal> execution target
</Goals>
<Configuration>
<ScanIntervalSeconds> 0 </scanIntervalSeconds>
<Daemon> true </daemon>
</Configuration>
</Execution>
<Execution>
<Id> stop-jetty </id>
<Phase> post-integration-test </phase>
<Goals>
<Goal> stop </goal>
</Goals>
</Execution>
</Executions>
[Html] Port, root, and other configurations:
<Configuration>
<Contextpath>/</contextpath>
<Connectors>
<Connector implementation = "org. mortbay. jetty. nio. SelectChannelConnector">
<Port> 8080 </port>
<Maxidletime> 60000 </maxidletime>
</Connector>
</Connectors>
<Scanintervalseconds> 10 </scanintervalseconds> // scan time for resource file changes
<Webdefaultxml> src/main/resources/webdefault. xml </webdefaxml xml> // This file replaces src/webapp/WEB-INF/web. xml
<Webappsourcedirectory >$ {basedir}/src/staticfiles </webappsourcedirectory>/default is src/webapp
<Webxml> $ {basedir}/src/over/here/web. xml </webxml> // default is src/webapp/WEB-INF/web. xml
<Classesdirectory >$ {basedir}/somewhere/else </classesdirectory> // default is target/classes/
</Configuration>
Port, root, and other configurations:
<Configuration>
<Contextpath>/</contextpath>
<Connectors>
<Connector implementation = "org. mortbay. jetty. nio. SelectChannelConnector">
<Port> 8080 </port>
<Maxidletime> 60000 </maxidletime>
</Connector>
</Connectors>
<Scanintervalseconds> 10 </scanintervalseconds> // scan time for resource file changes
<Webdefaultxml> src/main/resources/webdefault. xml </webdefaxml xml> // This file replaces src/webapp/WEB-INF/web. xml
<Webappsourcedirectory >$ {basedir}/src/staticfiles </webappsourcedirectory>/default is src/webapp
<Webxml> $ {basedir}/src/over/here/web. xml </webxml> // default is src/webapp/WEB-INF/web. xml
<Classesdirectory >$ {basedir}/somewhere/else </classesdirectory> // default is target/classes/
</Configuration>
You can also specify mvn-D jetty. port = 9999 jetty: run by using command parameters.
Mvn jetty: run-war, mvn jetty: deploy-war runs $ {project by default. build. directory}/$ {project. build. finalName }. the difference is that jetty: deploy-war does not trigger compilation, and mvn cycles such as testing