Command mvn jetty: run, mvnjetty
How to use the command mav jetty: run?
There is a simple display as below:
Step 1:
You shoshould generate a web project with maven first.
You coshould go"Using Maven to generate a Java Project or Web project"To know how to generate a Web project with maven in Windows 7.
Step 2:
Change the pom. xml in as bellow in the web project you have generated just now.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.b510.shopping</groupId> <artifactId>shopping-core</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>shopping-core Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>shopping-core</finalName> <pluginManagement> <!--Configuration for Jetty--> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin> </plugins> </pluginManagement> </build></project>
Step 3:
Type the commandMvn jetty: run
NOTE:You shoud go to the "F:/maven/shopping-core" directory to execute abve command.
Step 4:
Open a broswer and type "http: // localhost: 8080/shopping-core"
========================================================== ======================
More reading, and english is important.
I'm Hongten
E | hongtenzone@foxmail.com B | http://www.cnblogs.com/hongten
========================================================== ======================
How to Set (Change) jetty (maven plug-in maven
When using the jetty maven plug-in, there are two ways to change the jetty server port. The first method is relatively simple:
Specify the port through the command line:
Mvn-Djetty. port = 9999 jetty: run
Another method is to specify a new ctor In the pom configuration, such as the following configuration documents: <plugin <groupIdorg. mortbay. jetty </groupId
<ArtifactIdmaven-jetty-plugin </artifactId
<Version6.1.26 </version
<Configuration
<ScanIntervalSeconds3 </scanIntervalSeconds
<Connectors
<Connector implementation = org. mortbay. jetty. nio. SelectChannelConnector
<Port9090 </port
</Connector
</Connectors
<ScanTargetPatterns
<ScanTargetPattern
<Directorysrc/main/webapp/WEB-INF </directory
<Excludes
<Exclude **/*. jsp </exclude
</Excludes
<Shortdes
<Include **/*. properties </include
<Include **/*. xml </include
</Shortdes
</ScanTargetPattern
</ScanTargetPatterns
Mvn jetty: run reports javalangClassNotFoundException: orgspringframeworkwebcontextContextLoaderLis
The spring-web package is not imported.
<Dependency>
<GroupId> org. springframework </groupId>
<ArtifactId> org. springframework. web </artifactId>
<Version> 3.1.1.RELEASE </version>
</Dependency>