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.


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Trying-to-use-expand-in-the-copy-task-tp4922799p4923497.html
Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Reply via email to