我想要一个启用热重载的 wro4j 码头,它不会仅仅因为 css 文件中的字符发生变化而杀死整个服务器几秒钟。
我已经设置 wro4j 来定位类路径之外的 css 资源。
<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro">
<group name="style">
<css>file:src/main/less/style.css</css>
</group>
</groups>
我已经设置了 jetty 以仅查看 webapp 目录的更改:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.1.0.M0</version>
<configuration>
<scanTargets>
<scanTarget>${basedir}/src/main/webapp</scanTarget>
</scanTargets>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
</plugin>
不过,如果我更改目录 /src/main/less 中的某些内容,jetty 会自行重新启动:
[INFO] restarting o.e.j.m.p.JettyWebAppContext@6ebc4e13{/,[file:/home/tamas/ux/src/main/webapp/, jar:file:/home/tamas/.m2/repository/org/webjars/jshint/2.1.3/jshint-2.1.3.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/less/1.3.3/less-1.3.3.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/emberjs/1.0.0-rc.5/emberjs-1.0.0-rc.5.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/jquery/1.9.1/jquery-1.9.1.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/handlebars/1.0.0-rc.4/handlebars-1.0.0-rc.4.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/coffee-script/1.6.3/coffee-script-1.6.3.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/jslint/c657984cd7/jslint-c657984cd7.jar!/META-INF/resources/, jar:file:/home/tamas/.m2/repository/org/webjars/json2/20110223/json2-20110223.jar!/META-INF/resources/],AVAILABLE}{file:/home/tamas/ux/src/main/webapp/}
我想避免重新启动,因为它很烦人。
我正在使用 wro4j 1.7.1、Maven 3.0.4 和 Jetty 9.1.0.M0。
更新:重新启动是因为我用 Eclipse 编辑了文件。否则 Jetty 不会自行重启。