我想要一个带有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不会重启。
答案 0 :(得分:2)
如果您想在修改时获得最新更改,可以尝试使用“resourceWatcherUpdatePeriod”wro4j configuration。我认为默认情况下jetty会在检测到更改时执行重启。