In the Java Web project, the pom. xml file initially creates the Jetty runtime environment.
In the Java Web project, the pom. xml file initially creates the Jetty runtime environment.
1. pom. xml file encoding settings
<? Xml version = "1.0" encoding = "UTF-8"?>
2. attribute settings
<Properties>
<! -- General Attributes -->
<Java. version> 1.6 </java. version>
<Project. build. sourceEncoding> UTF-8 </project. build. sourceEncoding>
<Project. reporting. outputEncoding> UTF-8 </project. reporting. outputEncoding>
<! -- Jetty attribute to ensure the Java web runtime environment -->
<Jetty. version> 8.1.9.v20130131 </jetty. version>
</Properties>
3. Dependency settings
<Dependencies>
<! -- Jetty -->
<Dependency>
<GroupId> org. eclipse. jetty. aggregate </groupId>
<ArtifactId> jetty-webapp </artifactId>
<Version >$ {jetty. version} </version>
<Scope> test </scope>
</Dependency>
<Dependency>
<GroupId> org. eclipse. jetty </groupId>
<ArtifactId> jetty-jsp </artifactId>
<Version >$ {jetty. version} </version>
<Scope> test </scope>
</Dependency>
</Dependencies>
4. Run plug-in settings
<Build>
<Plugins>
<! -- Jetty plug-in, set context path and spring profile -->
<Plugin>
<GroupId> org. mortbay. jetty </groupId>
<ArtifactId> jetty-maven-plugin </artifactId>
<Version >$ {jetty. version} </version>
<Configuration>
<SystemProperties>
<SystemProperty>
<Name> spring. profiles. active </name>
<Value> development </value>
</SystemProperty>
</SystemProperties>
<UseTestClasspath> true </useTestClasspath>
<WebAppConfig>
<ContextPath>/$ {project. artifactId} </contextPath>
</WebAppConfig>
</Configuration>
</Plugin>
</Plugins>
</Build>
Use Jetty as an Embedded Server
Jetty source code analysis
Jetty installation learning and demonstration
Install Jetty in Eclipse
Jetty details: click here
Jetty's: click here
This article permanently updates the link address: