源:http://www.juziku.com/sunlightcs/wiki/4121.htm
评:
maven常用插件之jetty
插件作用:在maven项目中,使用jetty运行maven项目。
在pom.xml里添加如下配置
1
2
3
4
5
6
7
8
9
10
11
|
<
plugin
>
<
groupId
>org.mortbay.jetty</
groupId
>
<
artifactId
>jetty-maven-plugin</
artifactId
>
<
version
>8.0.1.v20110908</
version
>
<
configuration
>
<
scanIntervalSeconds
>10</
scanIntervalSeconds
>
<
webAppConfig
>
<
contextPath
>/demo</
contextPath
>
</
webAppConfig
>
</
configuration
>
</
plugin
>
|
mvn jetty:run 在jetty中运行maven项目,默认的端口号8080
mvn jetty:run -Djetty.port=8082 在jetty中运行maven项目,端口号改成8082
项目的访问路径为:http://localhost:8082/demo
如果 <contextPath>/demo</contextPath>设置为 <contextPath>/</contextPath>,
则访问路径为:http://localhost:8082