简体   繁体   English

如何在Play Framework 2.0中贡献模块?

[英]How to contribute modules in Play Framework 2.0?

The original Play Framework 1.x had an elegant and simple module management system. 最初的Play Framework 1.x拥有一个优雅而简单的模块管理系统。 Coupled with the Play repository, it was a great way to quickly enhance an application with third party components & libraries. 与Play存储库相结合,它是使用第三方组件和库快速增强应用程序的好方法。

With Play 2.0, things are very different. 使用Play 2.0,情况就大不相同了。

How does one contribute the so called " modules "? 如何贡献所谓的“ 模块 ”?

Quoting Guillaume Bort from the mailing list: 从邮件列表中引用Guillaume Bort:

modules are just standard subprojects. 模块只是标准的子项目。

[...] now as everything is compiled, your module routes file must define its own route for controllers.Assets.at [...]现在一切都已编译,您的模块路由文件必须为controllers.Assets.at定义自己的路由

By the way, the route inclusion between modules is not ready yet. 顺便说一下,模块之间的路由包含还没有准备好。 Will work on that soon. 将尽快开展工作。

Simply explained, now any SBT project can be a Module . 简单解释一下,现在任何SBT项目都可以成为一个模块 Which is (somehow) an improvement, as you can import existing projects without having to convert them to a specific "Play framework module project" format. 这是(某种程度上)一种改进,因为您可以导入现有项目而无需将它们转换为特定的“Play框架模块项目”格式。

For example, in Play 1.x you have several modules which provide a lot of the logic inside a jar file that belongs to the "Play Module" project. 例如,在Play 1.x中,您有几个模块,这些模块在属于“Play模块”项目的jar文件中提供了大量逻辑。 The source of that jar is not in the same project, which may complicate debugging. jar的源不在同一项目中,这可能使调试复杂化。 With the new system you can simply import the sbt-jar project (no need to create a wrapper project) or, if you are importing a Play project that contains that other project, you can follow the dependencies more easily. 使用新系统,您只需导入sbt-jar项目(无需创建包装器项目),或者,如果要导入包含该项目的Play项目,则可以更轻松地跟踪依赖项。

An additional benefit is that you can reuse full Play projects as Modules. 另一个好处是您可以将完整的Play项目重用为模块。 Which means that your Admin module for application X can be created as a full and independent Play project and then reused in Application Z by just adding a line to the Sbt build file. 这意味着您的应用程序X的管理模块可以创建为完整且独立的Play项目,然后只需在Sbt构建文件中添加一行即可在Application Z中重用。 Lots of possibilities in there. 那里有很多可能性。

If you want to create/contribute a module for Play 2.x and don't know where to start check out this two-parts tutorial. 如果您想为Play 2.x创建/贡献一个模块,并且不知道从哪里开始,请查看这个由两部分组成的教程。

Have a look at https://github.com/playframework/modules.playframework.org/wiki . 看看https://github.com/playframework/modules.playframework.org/wiki

This Play 2.0 appliction will be the official Play Framework modules directory, hosted at modules.playframework.org, and will replace the original Play 1.x modules page. 这个Play 2.0应用程序将是官方Play Framework模块目录,在modules.playframework.org上托管,并将取代原始的Play 1.x模块页面。

It's in an very early stage at the moment and help is certainly needed. 目前处于非常早期的阶段,肯定需要帮助。 Contribution is possible. 贡献是可能的。 Check out: https://github.com/playframework/modules.playframework.org 查看: https//github.com/playframework/modules.playframework.org

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM