您的位置:首页 > 编程语言 > Java开发

IntelliJ + Maven + 内Jetty 实现热部署项目

2016-10-07 18:45 323 查看
热部署的好处:代码修改后,不必关闭Jetty再重新启动,Maven启动时间不太和谐

。 

环境:

IntelliJ IDEA11.1.4, 

Maven2.2.1 
Jetty8.1.5
 

 

步骤:

1,在pom.xml文件中配置jetty插件的参数:scanIntervalSeconds,我的pom.xml片断如下:

<plugin> <groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>1</scanIntervalSeconds>
<stopPort>9966</stopPort>
<stopKey>foo</stopKey>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>7777</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<webAppConfig>
<contextPath>/jsf-web</contextPath>
</webAppConfig>
</configuration>
</plugin>
2,当修改了java文件时,在IntelliJ中按:‘Ctrl+Shift+F9’ 将重新编译该java文件, 
如果修改了多个java文件,按‘Ctrl+F9’
可以重新编译整个工程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java maven jetty