Hi
I needed some time to prepare my answer :)
This post is mainy about dependencies in Maven and Play! framework.
1. Play!
Play! 1.x has two independent dependency systems.
1.1. The legacy, but working one.
You can use Play! framework's built-in modules (crud, testrunnet, etc.)
by adding:
module.crud=${play.path}/modules/crud
to your project's "conf/application.conf" file
You can use external modules as well. You have to install a module with
"play install"
command. For example:
play install cobertura
and use it by adding:
module.cobertura=${play.path}/modules/cobertura-2.4
More info here:
http://www.playframework.com/documentation/1.1/modules
1.2. New one using "dependencies.yml" file
You define your project's dependencies in "conf/dependencies.yml" file
More info:
http://www.playframework.com/documentation/1.2.5/dependency
What is the difference between above dependency systems?
In 1.1 dependencies are inside Play! framework's (play home) "modules"
subdirectory.
In 1.2. dependencies are inside application's "modules" subdirectory.
2. Maven and play-maven-plugin
Maven has one dependency system with scopes. play-maven-plugin supports
both above Play! dependency systems.
The question is, how play-maven-plugin knows, if particular module
dependency should be expanded inside
Play! framework's "modules" subdirectory or application's "modules"
subdirectory.
The answer is, if the scope is "provided" it means that module should
be expanded inside framework's
"modules" subdirectory, and for all other scopes - inside application's
"modules" subdirectory.
Why "provided" scope id the key?
When you write servlet web application, you add 'servlet-api' with
"provided" scope.
This scope means that you need this dependency during compilation, but
don't need
in 'war' archive in runtime because your web server provides it.
Because in Play! framework there is no API for applications, whole
Play! framework
with built-in or installed modules is your application's API. If so,
framework and
built-in or installed Play! modules should be added to pom.xml with
"provided" scope.
On the other hand, if you add a module to your application's
'dependencies.yml' file,
this module should be unpacked to subdirectory of application's 'lib'
directory. It's
not part of Play! home content, so it should not have 'provied' scope
in Maven.
Play framework's dependency scope should be "provided" like all
modules' dependency scopes,
but in reality, play-maven-plugin doesn't care about it. Module
dependency scopes,
on the other hand, are very important.
play-maven-plugin does not require an existing Play! installation
directory (play home), but Play! needs one.
In the 'initialize' phase of Maven project build play-maven-plugin
creates on the fly
Play! home directory in 'target/play/home' directory.
Plugin finds framework dependency and unpacks in 'framework'
subdirectory and all
provided-scoped modules and unpacks them in 'modules' subdirectory.
What about non-provided-scoped modules?
There is play:dependencies mojo in play-maven-plugin. It's not bound to
"play" lifecycle.
It has to be invoked manually "mvn play:dependencies" or invocation
should be added to your application's
"pom.xml" file.
3. How framework and modules dependencies are being found by
play-maven-plugin
3.1. Framework
This is simple. Plugin finds dedendency of "zip" type with classifier
"framework" or "framework-min".
For example (from
http://repo2.maven.org/maven2/com/google/code/maven-play-plugin/play-app-default-parent/1.0.0-beta6/play-app-default-parent-1.0.0-beta6.pom):
<dependency>
<groupId>com.google.code.maven-play-plugin.org.playframework</groupId>
<artifactId>play</artifactId>
<version>${play.version}</version>
<classifier>framework-min</classifier>
<type>zip</type>
<scope>provided</scope>
</dependency>
3.2. Modules
Plugin finds all dependencies of "zip" type with "module" or
"module-min" classifier.
For example:
<dependency>
<groupId>com.google.code.maven-play-plugin.org.playframework.modules.testrunner</groupId>
<artifactId>play-testrunner</artifactId>
<version>${play.version}</version>
<classifier>module-min</classifier>
<type>zip</type>
<scope>provided</scope>
</dependency>
What id the difference between framework dependency with "framework"
and "framework-min" classifier?
What id the difference between module dependency with "module" and
"module-min" classifier?
Versions with "-min" suffix contain minimal file set required to work.
No documentation, test projects, etc.
This reduces decompress time during build.
You can declare both dependencies for framework or for the same module.
In this case "min" version is used
for build, and "full" version in full distribution preparing mojos
("dist" and "dist-exploded"). This logic
is hardcoded in play-maven-plugin.
4. How to deploy your own framework or module version.
You can use any groupId and artifactId. You have to prepare "zip" type
dependencies with
"framework" and/or "framework-min" classifier(s) for framework and
"module" and/or "module-min" classifier(s)
for every module.
When using your own framework or built-in modules you cannot use
"com.google.code.maven-play-plugin:play-app-default-parent" parent
because it depends on "default" Play! framework and built-in
"docviewer" and "testrunner" modules distributions.
Regards
Grzegorz Slowikowski
P.S.
I should write it somewhere in the wiki pages of my project.