From 3286053e5c9c90904259f712025ab3bcf4cb0943 Mon Sep 17 00:00:00 2001 From: Reguel Wermelinger Date: Mon, 25 Nov 2024 11:10:51 +0100 Subject: [PATCH] migrate to common-io-2.18.0 api --- .../maven/engine/deploy/dir/FileLogForwarder.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java index 682fb80b..33b74aa4 100644 --- a/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java +++ b/src/main/java/ch/ivyteam/ivy/maven/engine/deploy/dir/FileLogForwarder.java @@ -26,6 +26,7 @@ import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; import org.apache.commons.io.monitor.FileAlterationMonitor; import org.apache.commons.io.monitor.FileAlterationObserver; +import org.apache.commons.io.monitor.FileEntry; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; @@ -55,11 +56,14 @@ public synchronized void activate() throws MojoExecutionException { IOFileFilter logFilter = FileFilterUtils.and( FileFilterUtils.fileFileFilter(), FileFilterUtils.nameFileFilter(engineLog.getFileName().toString())); - FileAlterationObserver fileObserver = new FileAlterationObserver(engineLog.getParent().toFile(), logFilter); - fileObserver.addListener(new LogModificationListener()); - monitor = new FileAlterationMonitor(100); - monitor.addObserver(fileObserver); try { + FileAlterationObserver fileObserver = FileAlterationObserver.builder() + .setRootEntry(new FileEntry(engineLog.getParent().toFile())) + .setFileFilter(logFilter) + .get(); + fileObserver.addListener(new LogModificationListener()); + monitor = new FileAlterationMonitor(100); + monitor.addObserver(fileObserver); monitor.start(); } catch (Exception ex) { throw new MojoExecutionException("Failed to activate deploy log forwarder", ex);