嵌入式码头热部署 [英] hot deploy in embedded jetty
问题描述
我有一个Spring Roo项目,我使用mvn jetty:run
来运行我的应用程序.唯一的问题是对*.java
类的更改不进行热部署,而对*.jspx
类的更改进行良好的部署.
I have a Spring Roo project and I use mvn jetty:run
to run my app. The only problem is changes to the *.java
classes do not hot deploy, while changes to *.jspx
hot deploy fine.
那么如何为Java类将mvn jetty配置为hotdeploy?
So how can I configure mvn jetty to hotdeploy for java classes?
推荐答案
You need to set the scanIntervalSeconds
to a value greater than 0 to enable it:
scanIntervalSeconds
-扫描Web应用程序以进行更改并在必要时重新启动上下文的时间间隔(以秒为单位).忽略是否启用了重新加载.默认情况下禁用. 默认值为:0.
scanIntervalSeconds
- The interval in seconds to scan the webapp for changes and restart the context if necessary. Ignored if reload is enabled. Disabled by default. Default value is: 0.
因此配置可能如下所示:
So the configuration might looks like this:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.22</version>
<configuration>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
</plugin>
启用后,Jetty Maven插件将扫描 classDirecory
(默认指向${project.build.outputDirectory}
,即target/classes
)进行更改.
Once enabled, the jetty maven plugin will scan the directory defined in classDirecory
(which points to ${project.build.outputDirectory}
by default i.e. target/classes
) for changes.
然后,您只需在target/classes
中具有您的IDE编译类(或运行mvn compile
),Jetty将在Java类更改后重新启动上下文.
You then just need to have your IDE compile classes in target/classes
(or to run mvn compile
) and Jetty will restart the context upon changes on Java classes.
这篇关于嵌入式码头热部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!