How does one create a Play Module?

2019-02-04 07:26发布

问题:

The Play framework documentation is kind of weak when it comes to module creation.

  • How does one creates a Module ?
  • I've read that large applications could be split across several modules, how ?
  • What can/can't be done with a module ? (any access to low level api ?)
  • Can a play module expose abstract JPA classes ?
  • What's the best way to package a module ?
  • How to deploy/distribute a play module ?

I think you get the idea... tell us all about Modules using the Playframework.

回答1:

  • How does one creates a Module ?

play new-module

  • I've read that large applications could be split across several modules, how ?

Well you put components which functionality, for example security or user-management in a module. This module will be referred by you app.

  • What can/can't be done with a module ? (any access to low level api ?)

There are no special things that can be done with a module, with can't be done in your app directly. So if you need a special feature only in 1 app you can program it there directly.

  • Can a play module expose abstract JPA classes ?

There are no limits, you can declare there abstract-classes. Same as in a library.

  • What's the best way to package a module ?

play build-module

  • How to deploy/distribute a play module?

I mean in the discussion group there was plugin which enables you to run a private repository. If it was from general interest and you want to contribute it the whole community register it as a playframework.org, see the guide.

[UPDATE] I copied some information about the src-folder from google-group. The src-folder is for static utility-classes which are not play-specific and Play plugin. They will compiled as jars and put into the lib directory.

Niels