The Structure of a Play Application:
The structure of a Play Application is very similar to a other MVC application. There are Models, Views and Controllers folder under the app directory. In addition to app directory it will contain some other directories like conf, log, public, project, lib, test etc.
The
The
The
The
The
The
The
References:
The structure of a Play Application is very similar to a other MVC application. There are Models, Views and Controllers folder under the app directory. In addition to app directory it will contain some other directories like conf, log, public, project, lib, test etc.
app → Application sources
└ controllers → Application controllers
└ models → Application business layer
└ views → Templates
conf → Configurations files
└ application.conf → Main configuration file
└ routes → Routes definition
public → Public assets
└ stylesheets → CSS files
└ javascripts → Javascript files
└ images → Image files
project → sbt configuration files
└ build.properties → Marker for sbt project
└ Build.scala → Application build script
└ plugins.sbt → sbt plugins
lib → Unmanaged libraries dependencies
logs → Standard logs folder
└ application.log → Default log file
target → Generated stuff
└ scala-2.9.1
└ cache
└ classes → Compiled class files
└ classes_managed → Managed class files (templates, ...)
└ resource_managed → Managed resources (less, ...)
└ src_managed → Generated sources (templates, ...)
test → source folder for unit or functional testsThe app directory
The
app directory contains all executable artifacts: Java and Scala source code, templates and compiled asset's sources.There are three packages in the
app directory, one for each component of the MVC architectural pattern:app/controllersapp/models (for default application this folder is optional)app/views
We can add our packages, for example app/utility.
The conf directory
The
conf directory will contain the configuration files of the Play Application. There are two main configuration files:application.conf - the main configuration file for the application, which contains configuration parameters.routes - the routes definition file
The
public directoryAll resources stored in the
public directory are static assets that are served directly by the Web server. This directory is split into three sub-directories for Images, Css stylesheets and JavaScript files.In a newly-created application, the
/public directory is mapped to the /assets URL path, but you can easily change that, or even use several directories for your static assets.The project directory
The
project directory contains the sbt build definitions:plugins.sbtdefines sbt plugins used by this projectbuild.propertiescontains the sbt version to use to build your app.
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. If we want to use any JAR file then drop on the JAR file here and they will be added to your application classpath.The build.sbt file
The
build.sbt file contains the project main build declarations. The .scala files in the project/ directory can also be used to declare your project build.The target directory
The
target directory contains everything which is generated by the build system. It can be useful to know what is generated in this directory.classes/contains all compiled classes (from both Java and Scala sources).classes_managed/contains only the classes that are managed by the framework.resource_managed/contains generated resources, typically compiled assets such as LESS CSS and CoffeeScript compilation results.src_managed/contains generated sources, such as the Scala sources generated by the template system.web/contains assets processed by sbt-web such as those from the app/assets and public folders.
The .gitignore files
The generated folders should be ignored by your version control system. Here is the typical .gitignore file for the play application.
logs
project/project
project/target
target
tmp
dist
.cacheReferences:
- https://www.playframework.com/documentation/2.4.x/Anatomy
- http://jstricks.com/analysis-play-application-framework/
- http://richardstudynotes.blogspot.in/2013/01/v-behaviorurldefaultvmlo.html

0 comments:
Post a Comment