Closed cescoffier closed 12 years ago
Fixed in master.
Would it make sense to extend this to project properties?
If I have a multi-project maven build with a play project as a sub-project, I'll likely set up common dependency versions as properties in a root pom. Then every project can rely on the properties to keep dependency versions in sync.
If maven-play-plugin would expose
via environment variables (for example) the play SBT build specification could pick properties from its environment. There would be no need for the build file rewriting step, which has a hacky feel to it.
Commons-exec supports setting up environment for the invoked command line, it seems.
Hi,
That would be really good. Do you know how I can transfer such properties in SBT ? I've tried with: val appName = ${appName} and play dist -DappName="myApp", but it didn't work.
java.lang.System.getenv(), I think.
I'm more worried by the SBT side, how to you indicates to SBT the variables to replace. In our case, what can I write in the Build.scala to replace the appName by the value given as environment variable ?
2012/5/16 Teemu Antti-Poika < reply@reply.github.com
java.lang.System.getenv(), I think.
Reply to this email directly or view it on GitHub:
https://github.com/cescoffier/maven-play2-plugin/issues/16#issuecomment-5740295
I was thinking along these lines:
def fromEnv(name: String) = System.getenv(name) match {
case null => None
case value => Some(value)
}
val appName = fromEnv("APP_NAME").getOrElse("my-appt")
val appVersion = fromEnv("APP_VERSION").getOrElse("1.0-SNAPSHOT")
Ok, I agree it's a much better solution.
So several things:
I don't think there's much need to force that build file on all users or to touch users' build files at all.
If the values are offered as env variables, anyone can choose to use them (as above, that could be offered as an example) and get values from pom to sbt build; or not, in which case pom and build files are not synched?
So, that would mean disabling the current sync completely, and let the user write the SBT code he wants ?
That's what I was thinking.
Ok, I will modify the code to follow this. We will need to be really clear in the documentation.
Re-open issue to implement the new behavior
The proposed way is now implemented.
This issue is actually a metadata syncing issue between Maven and SBT. If you change the version in the Maven build, it's not mirrored in the Build.scala file.
So for example, if the Maven version is 1.0.0-SNAPSHOT and the SBT version is empty (""), you get a weird zip file:
The distribution use the following basedir:
Such as in
So, we should try to keep those metadata synced.