Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to contribute modules in Play Framework 2.0?

Tags:

The original Play Framework 1.x had an elegant and simple module management system. Coupled with the Play repository, it was a great way to quickly enhance an application with third party components & libraries.

With Play 2.0, things are very different.

How does one contribute the so called "modules"?

like image 966
Olivier Refalo Avatar asked Nov 08 '11 01:11

Olivier Refalo


People also ask

What are Play modules?

A Play module is a class that extends play.

Which component is responsible for building play framework?

Play Framework is an open-source web application framework which follows the model–view–controller (MVC) architectural pattern. It is written in Scala and usable from other programming languages that are compiled to JVM bytecode, e.g. Java.

What is activator in play framework?

The activator command can be used to create a new Play application. Activator allows you to select a template that your new application should be based off. For vanilla Play projects, the names of these templates are play-scala for Scala based Play applications, and play-java for Java based Play applications.

Is Play framework asynchronous?

Internally, Play Framework is asynchronous from the bottom up. Play handles every request in an asynchronous, non-blocking way. The default configuration is tuned for asynchronous controllers.


2 Answers

Quoting Guillaume Bort from the mailing list:

modules are just standard subprojects.

[...] now as everything is compiled, your module routes file must define its own route for controllers.Assets.at

By the way, the route inclusion between modules is not ready yet. Will work on that soon.

like image 82
Marius Soutier Avatar answered Sep 28 '22 09:09

Marius Soutier


Simply explained, now any SBT project can be a Module. Which is (somehow) an improvement, as you can import existing projects without having to convert them to a specific "Play framework module project" format.

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. The source of that jar is not in the same project, which may complicate debugging. 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.

An additional benefit is that you can reuse full Play projects as Modules. 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. Lots of possibilities in there.

like image 33
Pere Villega Avatar answered Sep 28 '22 11:09

Pere Villega