-
Notifications
You must be signed in to change notification settings - Fork 0
Writing Modules
Modules are the central idea to let the core of play 2.0 small on the one hand but deliver many functionality out of the box with play 2.0. You can find a good description how to do this at objectify. This article is the base of this page, but this should become not so detailed.
- Create a directory for your module, for example permsec.
- Create a application with provides the functionality with
play new psec
. Because it's a module deleteroutes
and delete the content ofapplication.conf
, but don't delete the file. - Write your code, but have in mind you don't can use the routes-class. If you need configuration, put all the default-values into
conf/reference.conf
. - Define version and name in
project/Build.scala
- Call
play clean
and thenplay publish-local
Now your module is ready and locally published.
- Create in the module directory here permsec a directory
samples-and-tests
. - Create a application which demonstrates how to use your module with
play new sample
. - Define the dependency to your new module in
/sample/project/Build.scala
val appDependencies = Seq(
"psec" % "psec_2.9.1" % "0.1"
)
- call
reload
in the play-console. You can check the loading with the commanddependencies
If you need further changes in your module you call in the module play clean
and then play publish-local
.
At the moment there is no central place to publish modules. One solution is to publish via github. The steps are following and based on Objectify:
-
Create a account foo in the following
<your username>
-
Create a module .github.com
-
Clone the module with
git clone <your username>.github.com
-
cd <your username>.github.com
-
mkdir releases
-
cp -rv ${PLAY_HOME}/repository/local/hurdy <your username>.github.com/releases
-
git add .
-
git commit
-
git push
Now you can easily refer your module if you add the following to your Build.scala
val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
// Add your own project settings here
resolvers += Resolver.url("<your username> GitHub Play Repository", url("http://<your username>.github.com/releases/"))(Resolver.ivyStylePatterns)
)
- Deploying your application
- Creating a standalone version of your application
- Additional configuration
- Deploying to Heroku
- Deploying to Cloud Foundry
- Deploying to dotCloud
- Set-up a front-end HTTP server
- Installing Play 2.0
- Creating a new application
- Anatomy of a Play 2.0 application
- Using the Play 2.0 console
- Setting-up your preferred IDE
- Sample applications