Skip to content

Commit

Permalink
pom.xml changes are also considered
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBien committed Jan 14, 2019
1 parent e8d68d1 commit 2e86fe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.airhacks</groupId>
<artifactId>wad</artifactId>
<version>0.0.6-SNAPSHOT</version>
<version>0.0.6</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -17,13 +18,16 @@ 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);
}

static void checkForChanges(ScheduledExecutorService scheduler, Path dir, Runnable changeListener) {
long initialStamp = getFolderModificationId(dir);
initialStamp += getPomModificationStamp();
boolean changeDetected = false;
while (true) {
try {
Expand All @@ -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) {
Expand Down

1 comment on commit 2e86fe9

@dempile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gott segne dich, mein Bruder

Please sign in to comment.