Files
Copy Task
task copyMyFiles(type: Copy) {
from 'myfiles'
into 'build/copied'
exclude '**/*test*'
include '**/*.sh'
}More complex copy task
def dataContent = copySpec {
from 'src/data'
include '*.data'
}
task initConfig(type: Copy) {
from('src/main/config') {
include '**/*.properties'
include '**/*.xml'
filter(ReplaceTokens, tokens: [version: '2.3.1'])
}
from('src/main/config') {
exclude '**/*.properties', '**/*.xml'
}
from('src/main/languages') {
rename 'EN_US_(.*)', '$1'
}
into 'build/target/config'
exclude '**/*.bak'
includeEmptyDirs = false
with dataContent
rename { fileName ->
"production-file${(fileName - 'file-template')}"
}
}Templates
Filtering file content
File by file
Files
FileTree
FileCollection operations
Source sets
Last updated