Module Antify allows you to generate ant project file for your play application. You can then use that project file to run your application with ant.
Requires version 1.8 of Apache Ant.
First you should add the module to the application.conf file:
Next you can generate the ant build.xml with
play antify ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.1, http://www.playframework.org ~ ~ Generating ant project file ... ~ File C:\Code\test-application\build.xml has been generated!
Now you can try out the ant
ant auto-test Buildfile: C:\Code\test-application\build.xml auto-test: [echo] Starting server and redirecting output to C:\Code\play-modules\test-application/logs/auto-test.out [echo] Waiting for the server to start up at http://localhost:9000/@tests [java] 14:55:21,897 INFO ~ Starting C:\Code\play-modules\test-application [java] 14:55:21,901 INFO ~ Module messages is available (C:\Code\play-modules\test-application\..\play-messages) [java] 14:55:21,901 INFO ~ Module carbonate is available (C:\Code\play-modules\test-application\..\play-carbonate) [java] 14:55:21,902 INFO ~ Module antify is available (C:\Code\play-modules\test-application\..\play-antify) [java] 14:55:22,369 WARN ~ You're running Play! in DEV mode [java] ~ [java] ~ Go to http://localhost:9000/@tests to run the tests [java] ~ [java] 14:55:22,432 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ... [java] 14:55:23,995 INFO ~ Connected to jdbc:hsqldb:mem:playembed [java] 14:55:24,000 INFO ~ Application 'test-application' is now started ! [echo] Testing server at: http://localhost:9000 [java] ~ 3 tests to run: [java] ~ [java] ~ BasicTest... PASSED 0s [java] ~ ApplicationTest... PASSED 0s [java] ~ Application... PASSED 3s [echo] Shutting down server [java] @KILLED BUILD SUCCESSFUL Total time: 12 seconds
To see all targets just run
Changing the play path
The generated build.xml contains a prefilled value for the play path property which is used by default. However it may be necessary to set the value for something else depending on the environment. This can be done in two ways:
- Override the path with a property when running the ant task, for example
ant -Dplay.path=<path to play> auto-test
- Set the path as an environment variable
export PLAY_PATH=<path to play> ant auto-test