Before you can implement your own functionality in a module, you should know how to create and build a module. This recipe takes a look at the module's structure and should give you a good start.
The source code of the example is available at examples/chapter5/module-intro
.
It is pretty easy to create a new module. Go into any directory and enter the following:
play new-module firstmodule
This creates a directory called firstmodule
and copies a set of predefined files into it. By copying these files, you can create a package and create this module ready to use for other Play applications. Now, you can run play build-module
and your module is built. The build step implies compiling your Java code, creating a JAR file from it, and packing a complete ZIP archive of all data in the module, which includes Java libraries, documentation, and all configuration files. This archive can be found in the dist/
directory of the module after building it....