Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between plugins, dependencies, modules and sub-projects in play 2.4?

I am new to the playframework and just learning.I am a little confused between dependencies, modules, plugins and sub-projects. How do they differ from each other?

Here's what i have understood, i may be wrong.

dependencies - are all the libraries needed for a play application to run. sub-project - is a play application inside another parent application. Not sure about 'plugin' and 'modules'.

Can someone please explain how they differ?

Note: I am working with Play 2.4 and play-java, not sure if the definitions change with play-scala.

like image 536
jesukumar Avatar asked Nov 18 '15 03:11

jesukumar


1 Answers

Your initial explanation is pretty much correct.

Dependencies are indeed libraries, more strictly, they are jar files (a fancy name for a zip file that contains java classes) that are distributed through a repository (the biggest repo is called Maven central) and downloaded by SBT.

Sub projects are best seen as libraries that are embedded directly into your build. If you run publishLocal, your subproject will be packaged up into a jar and deployed to your local repository. If you have configured your build to publish to a particular public (or private) repository, when you run publish, the jar and its metadata will be pushed there, where other projects can declare it in their dependencies. In fact, every project in an SBT build fits into this category. Your play project is in fact a library that could be depended on by something else.

Plugins and modules are grey terms that mean different things in different contexts.

For one, there are sbt plugins, these are declared in your project/plugins.sbt, and these add new behaviour to your build, such as the ability to compile less files. Play's dev mode is part implemented by an sbt plugin.

But then there's plugins to the Play runtime. We're currently phasing out this terminology, in favour of the word module, but it still does have some use.

We have some documentation already published on what a module is here:

https://www.playframework.com/documentation/2.4.x/Modules

So a module and a dependency may be one in the same thing, or they may not, a dependency may provide many modules, a single module could be provided by many transitive dependencies.

like image 170
James Roper Avatar answered Jan 03 '23 12:01

James Roper