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

岁酱吖の 提交于 2020-02-03 09:55:22

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/33771269/what-is-the-difference-between-plugins-dependencies-modules-and-sub-projects-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!