In this recipe, we will explore how to use the Play 2.0 plugin that will monitor the filesystem for a specified file. We will initialize our plugin as part of the Play web application lifecycle, and the main plugin logic will be triggered on application startup.
For Java, we need to perform the following steps:
Run the
foo_java
application with Hot-Reloading enabled:activator "~run"
Create the modules directory inside
foo_java
:mkdir modules
Generate the project directory for our first plugin inside
foo_java/modules
:activator new filemon play-java
Remove the contents of the
modules/filemon/conf/application.conf
file, as these settings will conflict with the main configuration file that we have defined in the project root:echo "" > modules/filemon/conf/application.conf
Remove the contents of the
modules/filemon/conf/routes
file and rename it tofilemon.routes
:echo "" > modules/filemon/conf/routes && mv modules...