Jetty插件实现热部署(开发时修改文件自动重启Jetty)

在pom.xml文件中配置Jetty插件的参数:scanIntervalSeconds

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
            <!--扫描项目变更的时间间隔,默认为0不扫描--> <scanIntervalSeconds>1</scanIntervalSeconds> <stopPort>8080</stopPort> <stopKey>bar</stopKey> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8080</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <webAppConfig> <contextPath>/</contextPath> </webAppConfig> </configuration> </plugin>

然后使用正常运行或者Debug运行都可以,不过时间应该在3秒以内会发现然后重启。

如果使用Eclipse的Jetty插件,很遗憾,没找到解决方法。

如果使用Eclipse的Tomcat插件,这个默认支持热部署的。时间也是3秒左右,不过好像静态文件支持不太好。

如果使用Maven的Tomcat插件,好像不行,没试过。

 

参考:

http://www.cnblogs.com/yanyd/p/5767278.html(以上内容转自此篇文章)

posted @ 2017-11-12 10:52  EasonJim  阅读(3071)  评论(0编辑  收藏  举报