New Play! App
Create a new Play site:
c:\> play new MySite
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ The new application will be created in /home/frederic/Projects/Java/play/MySite
~ What is the application name? [MySite]
~
~ OK, the application is created.
~ Start it with : play run MySite
~ Have fun!
Dependencies
see here for more information http://www.playframework.org/documentation/1.2.1/dependency
Edit dependencies with the dependencies.yml file:
requires:
- play ->[1.2, )
- play -> crud -> [1.1, )
- play -> secure -> [1.1, )
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ Resolving dependencies using /home/frederic/Projects/Java/play/MySite/conf/dependencies.yml,
~
~
~ Some dynamic revisions have been resolved as following,
~
~ play->play [1.2,) will use version 1.2.1
~
~ Installing resolved dependencies,
~
~ modules/crud -> /home/frederic/Tools/java/tools/play-1.2.1/modules/crud
~ modules/secure -> /home/frederic/Tools/java/tools/play-1.2.1/modules/secure
~
~ Done!
~
Edit !
What you will find in your favorite code editor :figure 1 - A new Play! app just created
You can install a gedit plugin to integrate the Zen Coding features. Just got to the following github repo :
https://github.com/mikecrittenden/zen-coding-gedit
Eclipse
c:\> cd MySitec:\> play eclipsify
And then import the existing project into Eclipse, and new files appear in the project directory:
figure 2 - "Eclipsifyed" Play! project
figure 2.1 - Eclipse "Import..." menu
figure 2.2 - The "Existing Projects into Workspace" wizard
figure 2.3 - Detected project into browsed directory.
figure 2.4 - Play! project importer into Eclipse, ready at work !
As easy as for Eclipse, you just have to use the magic command:
c:\>cd MySite
c:\> play netbeansify
And then, the directory structure is modified as shown bellow:
figure 3 - "NetBeansify'ed" Play! project
Run , start and stop
Run a play app:c:\> play run
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ Ctrl+C to stop
~
Listening for transport dt_socket at address: 8000
23:52:32,877 INFO ~ Starting /home/frederic/Projects/Java/play/MySite
23:52:32,915 INFO ~ Module secure is available (/home/frederic/Tools/java/tools/play-1.2.1/modules/secure)
23:52:32,915 INFO ~ Module crud is available (/home/frederic/Tools/java/tools/play-1.2.1/modules/crud)
23:52:34,026 WARN ~ You're running Play! in DEV mode
23:52:34,267 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
Or you can use the other command to not lock current terminal:
C:\> play start
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ OK, /home/frederic/Projects/Java/play/MySite is started
~ output is redirected to /home/frederic/Projects/Java/play/MySite/logs/system.out
~ pid is 19948
~
you can note the pid value, here 19948 (in case of manual kill action ? :)
And then you will be able to stop this play server with a :
c:\> play stop
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ OK, /home/frederic/Projects/Java/play/MySite is stopped
~
Browse
And then, open you favorite (sic) browser and ask for the http://localhost:9000/ url:figure 4 - Browser on a new Play! running project
Play help ?
c:\> play help
And the you will be free as bird to parse excellent documentation provided by the play distributed archive.
sample:
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.1, http://www.playframework.org
~
~ For all commands, if the application is not specified, the current directory is used
~ Use 'play help cmd' to get more help on a specific command
~
~ Core commands:
~ ~~~~~~~~~~~~~~
~ auto-test Automatically run all application tests
~ build-module Build and package a module
~ check Check for a release newer than the current one
~ classpath Display the computed classpath
~ clean Delete temporary files (including the bytecode cache)
~ crud:override Override a view
~ dependencies Resolve and retrieve project dependencies
~ eclipsify Create all Eclipse configuration files
~ evolutions Run the evolution check
~ evolutions:markAppliedMark pending evolutions as manually applied
~ evolutions:resolveResolve partially applied evolution
~ help Display help on a specific command
~ id Define the framework ID
~ idealize Create all IntelliJ Idea configuration files
~ install Install a module
~ javadoc Generate your application Javadoc
~ list-modules List modules available from the central modules repository
~ modules Display the computed modules list
~ netbeansify Create all NetBeans configuration files
~ new Create a new application
~ new-module Create a module
~ out Follow logs/system.out file
~ pid Show the PID of the running application
~ precompile Precompile all Java sources and templates to speed up application start-up
~ restart Restart the running application
~ run Run the application in the current shell
~ secret Generate a new secret key
~ secure: Show help for the secure module
~ secure:override Override the CSS, login or layout
~ start Start the application in the background
~ status Display the running application's status
~ stop Stop the running application
~ test Run the application in test mode in the current shell
~ war Export the application as a standalone WAR archive
~
~ Also refer to documentation at http://www.playframework.org/documentation
for more information, please, refer to the official web site : http://www.playframework.org/documentation/1.2.1/home
Or if you already have a running Play! project, just try to open the http://localhost:9000/@documentation
figure 5 - At any time, just display the provided help
Test
figure 6 - Test mode for Play! server






