Play modules
A Play application can be assembled from several application modules. This allows you to reuse application components across several applications or split a large application into several smaller applications.
What is a module?
A module is just another Play application; however some differences exist in the way resources are loaded for an application module:
- A module does not have a conf/application.conf file.
- A module can have a conf/routes file, but these routes will not be loaded automatically.
- All files are first searched for in the main application path, then in all loaded modules.
- A module can contain plain Java code packaged as a JAR file in the module/lib directory.
- A module can include a documentation page.
- Everything in a module is optional.
You can create a module with the play new-module command.
How to load a module from an application
Modules are automatically loaded from the /modules directory of the application. You can use thedependencies management system to automatically manage your application modules.
Load default routes from modules
A module can provide a default routes file. You can load it in the main application routes file, using a special route declaration:
# Import the default CRUD routes
GET /admin module:crud
You can even load routes from all available modules:
GET / module:*
Add documentation to a module
You can add a documentation page to a module simply by adding a the filedocumentation/manual/home.textile to the module. Use the same Textile syntax as the Play documentation itself, in ${play.path}/documentation/manual/.
If you are running a Play application that uses one or more modules with documentation, then the local Play documentation at http://localhost:9000/@documentation will include links to their documentation pages under Installed Modules in the side bar.
Using the module repository
The module repository identifies all modules contributed by the community. A module can have several versions. You have to check the module’s documentation for which version you need to use for your framework version.
You can also browse the module repository using the play list-modules command.
gbo-mac:~ guillaume$ play list-modules
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2, http://www.playframework.org
~
~ You can also browse this list online at http://www.playframework.org/modules
~
~ [bespin]
~ Bespin online editor
~ http://www.playframework.org/modules/bespin
~ Versions: 1.0, 1.0.1
~
~ [cobertura]
~ Cobertura
~ http://www.playframework.org/modules/cobertura
~ Versions: 1.0
...
You can install a module locally using the play install {module}-{version} command. Installing a module locally allow to use it from several application without having to install a different copy in each application. It is useful for large modules that are more framework extensions than your application extension.
For example, to install the Scala support to the framework, use:
play install scala-head
By convention the head version is the unstable version of the module. You can also install the default version of a module by omitting the version information. For example:
play install scala
Modules installed this way are downloaded to the /modules directory of your framework installation.
You can change the installation path using the --path option:
play install gwt --path=my-project
Contributing a new module to the module repository
First you need to have an OpenID. It will help us to authenticate you as author of your modules. Then send us a module registration request on the Google Group.
Please tell us:
- More about your module. What is it?
- Your module name. It must match the [a-zA-Z]+ regular expression.
- A short description of the module.
- Your project home page.
- Your OpenID.
- Your module must be hosted somewhere with the source code available and a way to report bugs. If you don’t have any idea, github, Google Code and Launchpad are good choices.
To release your module, simply use the play build-module command. Then connect to the module repository and upload the generated package.
You can of course use the offical Google Group to provide help and share information about your work.
Continuing the discussion
Learn how efficiently manage your modules using Dependencies management.
Play modules的更多相关文章
- YII的Modules模块化
转载来源: http://blog.csdn.net/mengxiangbaidu/article/details/7041296 http://blog.csdn.net/colzer/articl ...
- 在Angular1.X中使用CSS Modules
在Angular1.5中,增加了一个Component方法,并且定义了组件的若干生命周期hook,在代码规范中也是推崇组件化开发,但是很遗憾的是,CSS模块化组件化的问题并没有得到解决,大部分项目的打 ...
- 如何在Mac系统里面更新 Ansible 的 Extra Modules
最近遇到一个问题 seport is not a legal parameter in an Ansible task or handler 原因是我本地 Ansible 的 Extra Module ...
- Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
在eclipse里面配置tomcat时候遇到的问题: Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web mo ...
- 安装ESXi5.5遇到Relocating modules and starting up the kernel的处理
在一些Dell较旧的服务器上安装ESXi 5.x时, 会遇到卡在Relocating modules and starting up the kernel过不去的问题. 比如我装的这台CS24VSS. ...
- PHPCMS \phpcms\modules\member\index.php 用户登陆SQL注入漏洞分析
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述2. 漏洞触发条件 0x1: POC http://localhost/p ...
- PHPCMS \phpsso_server\phpcms\modules\phpsso\index.php、\api\get_menu.php Authkey Leakage
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 安装phpcms的时候会强制安装它的通行证 Relevant Link: ...
- ecshop /includes/modules/payment/alipay.php SQL Injection Vul
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 ECSHOP支付插件存在SQL注入漏洞,此漏洞存在于/includes/ ...
- TypeScript Modules(模块)
本文概述了TypeScript中如何使用模块以各种方式来组织代码.我们将涵括内部和外部的模块,并且讨论他们在适合在何时使用和怎么使用.我们也会学习一些如何使用外部模块的高级技巧,并且解决一些当我们使用 ...
随机推荐
- SQL Server数据库sql语句生成器(SqlDataToScript)的使用(sql server自增列(id)插入固定值)
SqlDataToScript是根据表数据进行生成 Insert Into语句,此工具还有一个好处是可以对自增列插入固定值,例如:自增的列id值为5,但是5这个行值已经删除,如果想存储Id自增列值为5 ...
- ComboTree 的json格式和引用
在easyui内,用 <select>实现combotree. <td ><select class="easyui-combotree" url=& ...
- 前端MVVM框架avalon揭秘 - HTML编译器
MVVM试图更加清晰的讲用户界面(UI)开发从应用程序的业务逻辑与行为中心分离,因为,很多这样的模式的实现都需要利用声明式数据绑定来实现讲View(视图)工作从其他层分离 所以出现了一大堆自定义的声明 ...
- Topology and Geometry in OpenCascade-Adapters
Topology and Geometry in OpenCascade-Adapters eryar@163.com 摘要Abstract:本文简要介绍了适配器模式(adapter pattern) ...
- 使用pudb调试python
本博客主要用于讲解如何使用pudb进行python调试: 1.安装 sudo pip install pudb pip list查看安装结果: 2.使用 测试程序: #!/usr/bin/env py ...
- Android之控件使用
Android系统为我们提供了大量的控件,例如:开关控件.单选按钮.多选按钮.单选菜单等等,那么这些控件如何使用呢?本篇我将带领大家一道学习一下如何使用这些控件.所谓无图无真相,先让大家看一下效果图: ...
- Android总结之json解析(FastJson Gson 对比)
前言: 最近为了统一项目中使用的框架,发现项目中用到了两种json解析框架,他们就是当今非常主流的json解析框架:google的Gson 和阿里巴巴的FastJson,为了废除其中一个所以来个性能和 ...
- Delete Volume 操作 - 每天5分钟玩转 OpenStack(57)
今天讨论 cinder 如何删除 volume . 状态为 Available 的 volume 才能够被 delete.如果 volume 当前已经 attach 到 instance,需要先 de ...
- 克隆您的Git代码库和添加源文件
内容正在建设中 标签:Bitbucket
- iOS开发之山寨版新浪微博小结
在之前的博客IOS开发之新浪围脖中获取微博的内容是使用我自己的access_token来请求的数据,那么如何让其他用户也能登陆并获取自己的微博内容呢?接下来就是OAuth和SSO出场的时候啦.OAut ...