Jetty 的Maven插件适合快速开发和测试。
The Jetty Maven plugin is useful for rapid development and testing. You can add it to any webapp project that is structured according to the usual Maven defaults. The plugin can then periodically scan your project for changes and automatically redeploy the webapp if any are found. This makes the development cycle more productive by eliminating the build and deploy steps: you use your IDE to make changes to the project, and the running web container automatically picks them up, allowing you to test them straight away.
http://eclipse.org/jetty/documentation/current/jetty-maven-plugin.html
实现在pom.xml 加上jetty-maven-plugin
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.2.v20140723</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
然后运行
mvn 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/
使用Jetty的Maven插件可以实现项目的快速开发与测试。通过在pom.xml中配置jetty-maven-plugin,该插件能够周期性地扫描项目变更并自动重新部署Web应用,大大提升了开发效率。
1107

被折叠的 条评论
为什么被折叠?



