Eine Ersetzung:
1 2 3 4 5 |
task fooBar(type: Copy) { from file("${projectDir}/foo/bar.xml") into("${projectDir}/xy/z") filter { line -> line.replaceAll('someString', 'someReplacement') } } |
Mehrere Ersetzungen:
1 2 3 4 5 6 7 8 9 10 11 |
import org.apache.tools.ant.filters.ReplaceTokens task fooBar(type: Copy) { from file("${projectDir}/foo/bar.xml") into("${projectDir}/xy/z") filter(ReplaceTokens, tokens: [ // requires targets to be wrapped in '@', like '@someString@': 'someString' : 'someReplacement', 'someOtherString': 'someOtherReplacement', ]) } |