Found this: http://mrhaki.blogspot.com/2010/10/gradle-goodness-parse-files-with.html And I've been looking at the documentation: http://www.gradle.org/releases/1.0-milestone-3/docs/dsl/org.gradle.api.tasks.Copy.html
However I'm having trouble getting a task to work. It's a dynamic task, and I've gotten that stuff working. Basically we have a properties file, and then some filters we apply to it, to set the values for those properties in different deployment environments. I've gotten the properties file loaded, and the task written to export the data, but it bombs horribly. First the dynamic task: <paste> [ "local", "prod", "staging", "test", "uat"].each() { env -> task("configuration$env", type: Copy) { def props = new Properties() doFirst { println "Loading up teh properties for ${env}" //Load in the properties file new File("src/main/filters/filter-${env}.properties").withInputStream { stream -> props.load(stream) } props.each() { k,v -> println "---> ${k} --> ${v}" } } from("src/main/config") into "build/properties/$env" expand(props) } processResources.dependsOn "configuration$env" } </paste> The properties exist and are loaded. the println for the props.each() happens and I see the proper properties, as listed: <output> $ gradle clean test :clean :configurationlocal Loading up teh properties for local ---> my.hazelcast.multicast.group --> 224.1.1.130 ---> my.database.schema --> PUBLIC ---> my.hazelcast.multicast.port --> 54445 ---> my.scheme --> http ---> my.database.dialect --> org.hibernate.dialect.H2Dialect ---> my.authority --> localhost:8185 ---> my.hazelcast.group.name --> incident-dev ---> my.database.url --> jdbc:h2:mem:change-db;DB_CLOSE_DELAY=-1;MODE=oracle ---> my.hazelcast.network.port --> 31337 ---> my.hazelcast.log.enabled --> false ---> my.database.hbm2ddl.auto --> create ---> my.database.driverClassName --> org.h2.Driver ---> my.hazelcast.multicast.enabled --> true ---> my.hazelcast.group.password --> development is fun ---> my.database.password --> INCIDENT ---> my.servicemix.wsdlLocation --> http://path/to/some/wsdl ---> my.incident.geoId --> US ---> my.database.username --> INCIDENT FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':configurationlocal'. Cause: Could not copy file '/home/dkowis/gitwork/itsm/incident-service/src/main/config/incident-service.properties' to '/home/dkowis/gitwork/itsm/incident-service/build/properties/local/incident-service.properties'. Cause: No such property: my for class: SimpleTemplateScript1 </output> So as I read the documentation, passing in the props to the thing should enable the template engine to have the right data to filter my properties files correctly, but it doesn't appear to be :( I'm sure I'm doing something simple wrong, that looks like it should work, but doesn't. How do I get the properties values into that expand "method" so that my files will be properly filtered? Thanks in advance for help, David
signature.asc
Description: OpenPGP digital signature