One, Play installation and configuration
1. First go to the official website to download the Play Package and unzip it
I'm under the playframework2.2.1 .
2. Configure play 's environment variables for easy use
3. Open cmd to run play
Enter play help to see if it's successful
Ii. How to build an eclipse java project with Play
1. First create a play java Project
Enter play New Playtest
2. Go to the project directory to run play
The first time may be slower play need to download something
3. Import the project into Eclipse
Now enter Eclipse in play
Make sure that environment variables such as JDK and JRE are correct, or you may get an error.
After success
Then open Eclipse through file/import/general/existing project ... Import the project into eclipse.
Third, the project directory structure
1.The App directory contains all the executable artifacts : Java and Scala Source code , The source of the compilation.
There are three standard packages in the application directory , that MVC Architecture :
You can also build your own package.
There is also an optional directory app/assets to store less, CSS sources, and coffeescript sources
The 2.public directory is a static resource that is stored directly for the Web server.
This directory is divided into three standard subdirectories: pictures, CSS stylesheets, and JavaScript files.
You should organize such static resources to keep all play programs consistent.
The 3.conf directory contains the application's configuration files. There are two main types of configuration files:
Application.conf. Seminars, primarily application configuration files, which contain standard configuration parameters
Routes, the route definition file.
If you need to add application-specific configuration options, a good idea is to add more options to your application. conf file.
If a library requires a specific configuration file, try placing it in the Conf directory.
4.lib catalog is optional, storing and managing jar packages
5. The main item in your project is typically placed in the BUILD.SBT file, and the. Scala file placed in the project directory can also describe the structure of the project.
The 6.Project catalog contains the SBT structure definition
PLUGINS.SBT contains the SBT plug-in used for the project
Build.properties contains the SBT version that builds your program
The 7.target catalog contains everything that the system constructs and can be used to see what is produced.
The classs/contains all the compiled classes
Class_managed/contains classes that are generated by the framework
Resource_managed/contains generated resources, usually compiled with less CSS and Coffeescript compiled results.
Src_managed/contains the source of the build, such as a template system that generates a Scala source.
8. The generated folder is ignored by your version control system and will be placed in the. gitignore file of the play app.
Four, console commands
Play Console common commands
First: Play Help
Second: Play Start play program
Third: Run enables the server to operate in development mode and prepares your project to access the browser
IV: Exit or ctrl+d leave the console
V: Compile compiled application
Sixth: Console starts the interactive console: Enter the interactive Scala console to test your code
Seventh: Play debug can link to the Java debugger after opening the JPDA debug port (default is 9999).
The JPDA port can be set via the set jpda_port= value (e.g. 1234) command
Eighth: Use the SBT feature to run commands such as play, run, compile, etc. into the project folder
Nineth: Use the play command directly in the console, such as enter CMD directly after the play run, play help
Tenth: Play Clean-all Clear all the build directories
Installation and configuration of Playframework and import of project projects to eclipse