Closed GoogleCodeExporter closed 8 years ago
You are right, "app" and "conf" directory names are hardcoded now.
1. Templates
There is one source root directory in Maven project
(project/build/sourceDirectory) but more can be added at runtime (using
"build-helper-maven-plugin" for example)
In Play(SBT) project there is a sequence of source root directories named
"unmanagedSourceDirectories".
So Maven and SBT have similar configurations.
Play! templates compiler searches template files in all
"unmanagedSourceDirectories".
"PlaySettings.scala" fragment:
sourceGenerators in Compile <+= (state, unmanagedSourceDirectories in Compile, sourceManaged in Compile, templatesTypes, templatesImport) map ScalaTemplates,
2. Routes
Play! routes compiler works differently. It does not search routes files in all
resources root directories ("unmanagedResourceDirectories" setting). There is
"confDirectory" setting in "PlaySettings.scala". It's single directory, not a
sequence of directories.
"PlaySettings.scala" fragment:
confDirectory <<= baseDirectory / "conf",
sourceGenerators in Compile <+= (state, confDirectory, sourceManaged in Compile, routesImport, generateReverseRouter, namespaceReverseRouter) map { (s, cd, sm, ri, grr, nrr) =>
RouteFiles(s, Seq(cd), sm, ri, grr, nrr)
},
In Maven plugin I will not search routes files in all resource directories. I
will add "confDirectory" plugin configuration parameter (pointing to "conf"
directory by default) and will use this parameter.
3. Assets
"PlaySettings.scala" fragment:
sourceDirectory in Compile <<= baseDirectory / "app",
lessEntryPoints <<= (sourceDirectory in Compile)(base => ((base / "assets" ** "*.less") --- base / "assets" ** "_*")),
coffeescriptEntryPoints <<= (sourceDirectory in Compile)(base => base / "assets" ** "*.coffee"),
javascriptEntryPoints <<= (sourceDirectory in Compile)(base => ((base / "assets" ** "*.js") --- (base / "assets" ** "_*"))),
"sourceDirectory" key is different from "unmanagedSourceDirectories". Default
SBT value for "sourceDirectory in Compile" is baseDirectory / "src/main". It's
overridden in Play! and points to baseDirectory / "app". This is the same
location as for source files, but technically this is different setting.
How should I parametrize it in Maven?
For example, if you want sources to be located in "src/main/java" and
"src/main/scala" (as is in SBT by default), where would you expect assets? In
"src/main/java/assets" and "src/main/scala/assets" ("assets" subdirectories of
source roots) or in "src/main/assets" (location outside of source roots)?
The simplest solution would be adding "sourceDirectory" plugin configuration
parameter, but I don't like it. I must think about it. And what do you think?
Original comment by gslowiko...@gmail.com
on 9 Jan 2014 at 8:39
1. (templates compilation) implemented in
http://code.google.com/p/play2-maven-plugin/source/detail?r=369
Original comment by gslowiko...@gmail.com
on 3 Apr 2014 at 1:41
https://code.google.com/p/play2-maven-plugin/source/detail?r=588 - "conf"
directory location parametrized.
Original comment by gslowiko...@gmail.com
on 31 May 2014 at 6:33
https://code.google.com/p/play2-maven-plugin/source/detail?r=589 - assets
directory location parametrized.
Original comment by gslowiko...@gmail.com
on 31 May 2014 at 6:44
New 1.0.0-alpha7-SNAPSHOT snapshot deployed.
Original comment by gslowiko...@gmail.com
on 31 May 2014 at 7:06
Original issue reported on code.google.com by
michael....@googlemail.com
on 8 Jan 2014 at 2:29