Jetty Maven Plugin配置

官方文档:http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#maven-config-https

1,在pom.xml中引入jetty插件

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.11.v20160721</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <webApp>
                        <contextPath>/test</contextPath>
                    </webApp>
                </configuration>
            </plugin>
        </plugins>
    </build>

2,运行项目

jetty:run

注意:

Jetty默认扫描目录如下,如果在其它目录需要另外配置

resources in ${project.basedir}/src/main/webapp
classes in ${project.build.outputDirectory}
web.xml in ${project.basedir}/src/main/webapp/WEB-INF/

PS:IDEA中给Java项目添加webapp目录

右键项目,选择如下:

然后选择Weg Application,添加成功后需要根据jetty默认要求调整目录结构

或者直接在Project Structure中添加

 

posted @ 2016-08-01 17:56  桐城东旭  阅读(981)  评论(0编辑  收藏  举报