GradleScriptでファイルコピーしようとしてCopyTask使ったら、コピー先が複数指定できなくて困ったときに発見したやつ
CopyTask
- from:into=N:1 でしか書けない
build.gradle
// src/main/resources/*.properties --> $buildDir
task mycopy(type: Copy) {
from 'src/main/resources'
into '$buildDir/resources'
include '*.properties'
}
Project.copy()
- from:into=N:M も1つのタスクで実行できる
build.gradle
task mycopy {
// src/main/resources/*.properties --> $buildDir/prop/
copy {
from 'src/main/resources'
into '$buildDir/prop'
include '*.properties'
}
// src/main/resources/*.xml --> $buildDir/xml/
copy {
from 'src/main/resources'
into '$buildDir/xml'
include '*.xml'
}
}