Skip to content

Commit

Permalink
migrate to common-io-2.18.0 api
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Nov 25, 2024
1 parent 5b4605f commit 3286053
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3286053

Please sign in to comment.