} catch (MalformedURLException e) {
} catch (IOException e) {
}
}
// startScanner
Scanner scanner = new Scanner();
scanner.setReportExistingFilesOnStartup(false);
scanner.setScanInterval(scanIntervalSeconds);
scanner.setScanDirs(scanList);
scanner.setRecursive(true);
scanner.addListener(new Scanner.BulkListener() {
public void filesChanged(@SuppressWarnings("rawtypes") List changes) {
try {
// boolean reconfigure = changes.contains(getProject()
// .getFile().getCanonicalPath());
System.err.println("Stopping webapp ...");
web.stop();
if (webAppClassPath != null) {
ProjectClassLoader loader = new ProjectClassLoader(web,
config.getWebAppClassPath(),
config.getExcludedclasspath(), false);
web.setClassLoader(loader);
}
System.err.println("Restarting webapp ...");
web.start();
System.err.println("Restart completed.");
} catch (Exception e) {
System.err
.println("Error reconfiguring/restarting webapp after change in watched files");
e.printStackTrace();
}
}
});
System.err.println("Starting scanner at interval of "
+ scanIntervalSeconds + " seconds.");
try {
scanner.start();
} catch (Exception e) {
e.printStackTrace();
}
}