eclipse版本为eclipse-jee版,新建maven工程,在src/main/下新建java文件夹。
配置maven环境:
maven_home:meven的目录
path:%maven_home%\bin
在maven中集成jetty步骤:pom.cml中加入
<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.zkbc</groupId>
<artifactId>jetty-maven</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>jetty-maven 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>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>7.0.0.pre5</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<webApp>
<contextPath>/xx</contextPath>
</webApp>
</configuration>
<!--
它可以周期性地查看web应用,当应用有修改时,会立即重部署。运行jetty的命令即:
maven jetty:run
默认端口为:8080
-->
</plugin>
</plugins>
<finalName>jetty-maven</finalName>
</build>
</project>
运行jetty步骤:
运行测试: