hot deploy in embedded jetty

只愿长相守 提交于 2019-12-17 22:20:28

问题


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.

So how can I configure mvn jetty to hotdeploy for java classes?


回答1:


You need to set the scanIntervalSeconds to a value greater than 0 to enable it:

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>

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.

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.



来源:https://stackoverflow.com/questions/2369851/hot-deploy-in-embedded-jetty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!