On 10/20/2011 09:44 PM, TheKaptain wrote:
> Another available option is to use the Ant ExpandProperties filter:
> 
> <paste>
> import org.apache.tools.ant.filters.ExpandProperties
> 
> ["test"].each() { env ->
>     task("configuration$env", type: Copy) {
>         def props = new Properties()
>         new
> File("src/main/filters/filter-${env}.properties").withInputStream {
>             stream -> props.load(stream)
>         }
>         props.each() { k, v ->
>             println "---> ${k} --> ${v}"
>             ant.properties[k] = v
>         }
> 
>         from("src/main/config")
>         into "build/properties/$env"
>         filter(ExpandProperties, project: ant.project)
>     }
> }
> </paste>
> 
> This lets you keep the ${} style properties and still work with my.foo style
> properties that SimpleTemplateEngine won't handle.

Thanks. I'll look into that.

I need to break away from my maven style of thought, that if it isn't in
there, it's not easily doable ;)

Appreciate the snippit, but could you explain to me how the "project:
ant.project" stuff works?
I'm looking at this:
http://ant.apache.org/manual/Types/filterchain.html#expandproperties
which describes it for ant, but I'm not sure how it's being used in this
gradle script.

Thanks,
David

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to