嵌入式码头热部署 [英] hot deploy in embedded jetty

查看:146
本文介绍了嵌入式码头热部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆