I need some resources (text files) for my tests in a Scala Play 2.0 application. Where can I put these files?
In a maven app I would put them into src/test/resources
, but I cannot find anything about an equal directory in the Play documentation.
I can put them in the conf
directory, but I only need them when I test the application.
what is a resource? a resource is a file in the class path folder structure for your project. this is important because your test resources will be put in your test-classes folder hierarchy and your main resources will be put in your classes folder hierarchy — both in your target folder.
The lib/ directory The lib directory is optional and contains unmanaged library dependencies, ie. all JAR files you want to manually manage outside the build system.
Call
play "show test:resource-directory"
in the console and it shows you the absolute path to your resource directory in test mode. It will be in "test/resources".
"show" is a sbt command (or task) that enables you to retrieve the values of settings.
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