Maven Jetty - do not reload the whole application when modifying only static files

丶灬走出姿态 提交于 2019-12-11 07:14:36

问题


Maven Jetty plugin is very nice (I'm using version 6.1.26). The only annoying thing concerns static files' modifications. My web application uses Spring, follows the standard webapp Maven layout and I basically do not want the whole context to be reloaded whenever I change a JSP or a CSS file.

I checked the configuration settings, but didn't find anything about this.

Any idea ?

Thanks in advance !

Rolf


回答1:


You can set manual reload and:

  1. Your IDE (i.e. Eclipse) will copy static resources to target directory so they will be updated transparently.
  2. When you make changes in Java classes you only need to hit enter in the jetty process to reload.

To set manual reloading:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.26</version>
    <configuration>
        <reload>manual</reload>
    </configuration>
</plugin>



回答2:


I understand your need about CSS files or maybe html files, but take care, JSP files are actually Servlets. And a Servlet has to be undeployed in a way or another before reloading it.




回答3:


Set scanIntervalSeconds to -1

<plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <configuration>

          <scanIntervalSeconds>10</scanIntervalSeconds>

from http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin :

scanIntervalSeconds Optional. The pause in seconds between sweeps of the webapp to check for changes and automatically hot redeploy if any are detected. By default this is 0, which disables hot deployment scanning. A number greater than 0 enables it.



来源:https://stackoverflow.com/questions/9758983/maven-jetty-do-not-reload-the-whole-application-when-modifying-only-static-fil

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