Skip to content

Commit

Permalink
Issue #6020 Fix multiple restart after change to pom.xml
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <janb@webtide.com>
  • Loading branch information
janbartel committed Mar 9, 2021
1 parent 6478742 commit 0a8f9a6
Showing 1 changed file with 14 additions and 15 deletions.
Expand Up @@ -155,6 +155,20 @@ private void startScanner()
scanner.setScanInterval(scan);
scanner.setScanDepth(Scanner.MAX_SCAN_DEPTH); //always fully walk directory hierarchies
scanner.setReportExistingFilesOnStartup(false);
scanner.addListener(new Scanner.BulkListener()
{
public void filesChanged(Set<String> changes)
{
try
{
restartWebApp(changes.contains(project.getFile().getCanonicalPath()));
}
catch (Exception e)
{
getLog().error("Error reconfiguring/restarting webapp after change in watched files", e);
}
}
});
configureScanner();
getLog().info("Scan interval sec = " + scan);

Expand Down Expand Up @@ -199,21 +213,6 @@ protected void configureScanner()
{
throw new MojoExecutionException("Error forming scan list", e);
}
scanner.addListener(new Scanner.BulkListener()
{
public void filesChanged(Set<String> changes)
{
try
{
boolean reconfigure = changes.contains(project.getFile().getCanonicalPath());
restartWebApp(reconfigure);
}
catch (Exception e)
{
getLog().error("Error reconfiguring/restarting webapp after change in watched files", e);
}
}
});
}

public void gatherScannables() throws Exception
Expand Down

0 comments on commit 0a8f9a6

Please sign in to comment.