I'd like to have a hot-reloading enabled jetty with wro4j that does not kill the whole server for a few seconds just because a character has changed in a css file.
I have set up wro4j to locate css resources that is outside of the classpath.
<?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>
I have set up jetty to watch only the webapp directory for changes:
<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>
Still, if I change something in the directory /src/main/less, jetty restarts itself:
[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/}
I'd like to avoid this restart as it's very annoying.
I am using wro4j 1.7.1, Maven 3.0.4 and Jetty 9.1.0.M0.
Update: The restart happened because I edited the files with Eclipse. Jetty doesn't restart itself otherwise.
You could try using "resourceWatcherUpdatePeriod" wro4j configuration instead if you want to get the latest change whenever there is a modification. I think jetty by default performs a restart when a change is detected.