public void addWatchForTask(final Task task) throws IOException {
		if (task instanceof NodeJsTask) {
			NodeJsTask nodeJsTask = (NodeJsTask) task;
			Path sourceDir = nodeJsTask.workingDirectory.toPath();
			watchTasks.put(sourceDir, task);

			if (watchService == null) {
				watchService = sourceDir.getFileSystem().newWatchService();
			}

			Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() {
				@Override
				public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
					dir.register(watchService, watchEvents);
					watchTasks.put(dir, task);
					//getLog().info("Adding NodeJS watcher for: " + dir.toString());
					return FileVisitResult.CONTINUE;
				}
			});
		} else if (task instanceof ClosureCompilerTask) {
			final ClosureCompilerTask closureCompilerTask = (ClosureCompilerTask) task;

			if (watchService == null) {
				watchService = FileSystems.getDefault().newWatchService();
			}

			for (File source : closureCompilerTask.sources) {
				Path path = source.getParentFile().toPath();
				path.register(watchService, watchEvents);
				watchTasks.put(path, task);
				Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
						@Override
							public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
							dir.register(watchService, watchEvents);
							watchTasks.put(dir, task);
							//getLog().info("Adding Closure watcher for: " + closureCompilerTask.sources);
							return FileVisitResult.CONTINUE;
						}
					});
			}
		} else {
			watchService = null;
		}
	}