On Aug 18, 2009, at 1:37 PM, Trond Andersen wrote:

I've been looking at the user guide, but I haven't been able to see what is the best practice when it comes to handling different environments.

Maven has got its build profiles:

http://maven.apache.org/guides/mini/guide-building-for-different-environments.html

The use case I've got is that I have a few configuration parameters of the application which tells the webapp where to locate some resources by URL. These URL's aren't the same for system test, acceptance test and production environment and I have a need to parametrize this for different builds.

Profiles are a missing concept in Gradle 0.7. If your configuration is project specific, you could simple use some system property and set properties within the build.gradle file according to the value of the system property. If configuration is user and environment specific (e.g. different passwords for different environments), you could use a gradle.properties file with different property name suffixes and then apply them in your build script. This is hand crafted and pretty straight forward. In 0.8 there will be the choice of a user specific init script which can modify the build script.

At one point we will might support profiles. Possibly environment specific init scripts. But as said above, you can pretty easily model this concept yourself already. At least as long as this is about configuration that can be expressed by properties. Otherwise you would need the init script feature of 0.8.


Are configuration concept the way to go with Gradle? Any other solutions? Using ANT filter tasks?

Do you mean the configurations for assigning dependencies to?

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to