diff --git a/pom.xml b/pom.xml index 2414025..1571982 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.airhacks wad - 0.0.6-SNAPSHOT + 0.0.6 jar diff --git a/src/main/java/com/airhacks/wad/watch/control/FolderWatchService.java b/src/main/java/com/airhacks/wad/watch/control/FolderWatchService.java index 5304c0b..1fd2dec 100644 --- a/src/main/java/com/airhacks/wad/watch/control/FolderWatchService.java +++ b/src/main/java/com/airhacks/wad/watch/control/FolderWatchService.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; @@ -17,6 +18,8 @@ public interface FolderWatchService { static long POLLING_INTERVALL = 500; + static String POM = "pom.xml"; + public static void listenForChanges(Path dir, Runnable listener) throws IOException { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); checkForChanges(scheduler, dir, listener); @@ -24,6 +27,7 @@ public static void listenForChanges(Path dir, Runnable listener) throws IOExcept static void checkForChanges(ScheduledExecutorService scheduler, Path dir, Runnable changeListener) { long initialStamp = getFolderModificationId(dir); + initialStamp += getPomModificationStamp(); boolean changeDetected = false; while (true) { try { @@ -37,7 +41,10 @@ static void checkForChanges(ScheduledExecutorService scheduler, Path dir, Runnab initialStamp = getFolderModificationId(dir); } } + } + static long getPomModificationStamp() { + return getFileSize(Paths.get(POM)); } static boolean detectModification(Path dir, long previousStamp) {