How would I include a properties file in Gradle?
For example in Ant, I could do the following:
I have been sorely missing this feature of Ant, especially the in-property replacement like work.dir=${basedir}/work. With some of the large builds I work with that perform lots of environment setup for automated tests, there are some tasks that just need user and environment configurable settings. The simple "gradle.properties" just isn't enough, especially for settings that are shared across multiple projects.
I put together an example gradle file that manages a reasonable property loading scheme: load-properties.gradle. This lets the project define exactly the properties it uses in a default-properties.gradle file, and allows users to define their local settings to override them. Because the "property" files read in are gradle scripts, you can include extra logic in them, and the values aren't limited to just strings.
Additionally, it allows for defining a per-environment properties file to use (such as "mac", or "jenkins-machine", or "remote") by passing in a "-Penv=(env name)" parameter to gradle.