This file watch service is selected automatically on Apple machines and Linux or Windows machines with Java version before 1.7.
If you want to force this service when it wasn’t selected implicitely, there are three ways of doing so:
Add play2.fileWatchService project property with value jnotify.
This is simplest and recommended way.
<project> ... <properties> ... <play2.fileWatchService>jnotify</play2.fileWatchService> </properties> ... </project>
Add fileWatchService parameter with value jnotify to plugin configuration section.
<project> ... <build> ... <plugins> ... <plugin> <groupId>com.google.code.play2-maven-plugin</groupId> <artifactId>play2-maven-plugin</artifactId> <version>1.0.0-beta6</version> <extensions>true</extensions> <configuration> ... <fileWatchService>jnotify</fileWatchService> </configuration> </plugin> ... </plugins> </build> ... </project>
Add file watch service artifact as plugin dependency.
Warning: Only one file watch service can be added as plugin’s dependency at a time. It will be selected regardless of the value of fileWatchService plugin configuration parameter or play2.fileWatchService project property.
<project> ... <build> ... <plugins> ... <plugin> <groupId>com.google.code.play2-maven-plugin</groupId> <artifactId>play2-maven-plugin</artifactId> <version>1.0.0-beta6</version> <extensions>true</extensions> <dependencies> <dependency> <groupId>com.google.code.play2-maven-plugin</groupId> <artifactId>play2-source-watcher-jnotify</artifactId> <version>1.0.0-beta6</version> </dependency> </dependencies> </plugin> ... </plugins> </build> ... </project>
This service has only one configuration parameter - play2.nativeLibsDirectory. This is the directory, where JNotify native library will be extracted.
By default it’s native_libraries subdirectory of project build (target) directory.
It can be changed by adding play2.nativeLibsDirectory to project properties:
<project> ... <properties> ... <play2.nativeLibsDirectory>path/to/jnotify/native/library</play2.nativeLibsDirectory> </properties> ... </project>
or directly to Maven call:
mvn play2:run -Dplay2.nativeLibsDirectory=path/to/jnotify/native/library