I'm using the secure
and crud
modules with my app, and I've added them to application.conf as described in the tutorial. However, when I start my app, it generates a warning:
Declaring modules in application.conf is deprecated. Use dependencies.yml instead. (module.crud)
The modules then work while in dev mode, but when I deploy to my server (with play war
etc),
I get this:
13:55:40,662 WARN ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.crud)
13:55:40,662 ERROR ~ Module crud will not be loaded because /var/lib/apache-tomcat-6.0.32/webapps/pat/WEB-INF/modules/crud does not exist
So, two questions: why aren't my modules getting exported, and how do I declare them in dependencies.yml? I've looked at the dependency page in the docs, and I admit that I don't really get what's going on there.
Thanks!
When we want to export a single class/variable/function from one module to another module, we use the module. exports way. When we want to export multiple variables/functions from one module to another, we use exports way.
3.2. 9 MODULE declarations. A module is an encapsulated collection of declarations. Once defined, a module can be reused as many times as necessary. Modules can also be so that each instance of a module can refer to different data values.
All functions related to a single module are contained in a file. Module exports are the instructions that tell Node. js which bits of code (functions, objects, strings, etc.) to export from a given file so that other files are allowed to access the exported code.
The easiest way to set up modules in play 1.2+ is to use the --with keyword when you create your app.
For example
play new myapp --with crud,secure
The output of the generated dependencies.yml is
# Application dependencies
require:
- play
- play -> secure
- play -> crud
OK, solved it. I added
- play -> crud
- play -> secure
to dependencies.yml, and deleted the relevant lines in application.conf. Then I ran play dependencies
to copy the modules into my app. Play starts without any warnings, and the modules export to the WAR file correctly. I hope this helps people!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With