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中如何使用模块以各种方式来组织代码.我们将涵括内部和外部的模块,并且讨论他们在适合在何时使用和怎么使用.我们也会学习一些如何使用外部模块的高级技巧,并且解决一些当我们使用 ...
随机推荐
- c#设计模式-组合模式
在软件开发过程中,我们经常会遇到处理简单对象和复合对象的情况,例如对操作系统中目录的处理就是这样的一个例子,因为目录可以包括单独的文件,也可以包括文件夹,文件夹又是由文件组成的,由于简单对象和复合对象 ...
- easyui datagrid cell title换行
" " title="' +row.TaskName + "
- Linux核心源码阅读方法
首次阅读Linux4.0.5内核源代码时,一脸茫然,它的代码不仅复杂,而且庞大,找不到从哪里开始阅读. 通常Linux会有以下目录 arch 子目录包括所有和体系结构相关的核心代码.它还有更深的子目录 ...
- 浅谈ThinkPHP3.2的子域名部署和路由优化(一)
前言:建立一个网站系统,往往包含多个子网站,例如PC官网,移动端官网,后台管理,数据源自一个相同的数据库,整个架构上,从ThinkPHP来看,可以大体理解为Model(M)是一样的,Controlle ...
- c#代码命名规则
c#代码命名规则 以前没有考虑过命名的这个问题,写起来就是随心所欲,想怎么搞就怎么搞,在但是代码越写越乱,连自己都搞不清楚了,不得不进行认真考虑.参考了一些文章,形成以下想法: 一. ...
- js+css实现骰子的随机转动
网上找的例子,然后增添了新的东西,在这里展示一下...... 效果图预览: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio ...
- C#中使用Redis不同数据结构的内存占有量的疑问和对比测试
最近在大量使用Redis来进行数据统计前的清洗和整理,每天的数据量超5千万+,在开发过程中,数据量小,着重注意业务规则的处理,在上线基本测试后发现了大量的问题,其中之一就是Redis存储数据过多,内存 ...
- 安装Ubuntu时分区选择
最近购买来一台二手笔记本.型号是:Dell Latitude D520.回来之后就装上来Ubuntu12.04,开始是安装的UbuntuKylin 13.04.不知道是机器配置不行,还是本身系统有点卡 ...
- ES6 - Note2:解构赋值
ES6的解构赋值就是利用模式匹配从按照一定模式的数组或者对象中提取值赋值给变量. 1.数组的解构赋值 在ES6以前,变量的赋值是直接指定的,以后可以这么来写,如下所示 let [a,b,c] = [1 ...
- [c++] Operator overloading
c++的操蛋属性:自己为一档,空一档,其他随意. UB_stack a; UB_stack b = a; // copy auto c = a; auto d {a}; // (or auto d = ...