1
Ich möchte eine Gradle-Aufgabe definieren, die Dateien in vier verschiedene Verzeichnisse kopiert. Es scheint, dass die Kopieraufgabe nur einen einzelnen Zielort erlaubt.Wie kopiert man Dateien mit Gradle an mehr als einen Ort?
// https://docs.gradle.org/current/userguide/working_with_files.html#sec:copying_files
task copyAssets(type: Copy) {
from 'src/docs/asciidoc/assets'
//into ['build/asciidoc/html5/assets', 'build/asciidoc/pdf/assets']
into 'build/asciidoc/pdf/assets'
}
task gen(dependsOn: ['copyAssets', 'asciidoctor']) << {
println "Files are generated."
}
Wie kann ich kopieren Sie die Dateien ohne vier verschiedene Aufgaben zu definieren?
Meine aktuelle Lösung ist:
// https://docs.gradle.org/current/userguide/working_with_files.html#sec:copying_files
task copyAssetsPDF(type: Copy) {
from 'src/docs/asciidoc/assets'
into 'build/asciidoc/pdf/assets'
}
task copyAssetsHTML5(type: Copy) {
from 'src/docs/asciidoc/assets'
into 'build/asciidoc/html5/assets'
}
task copyAssetsDB45(type: Copy) {
from 'src/docs/asciidoc/assets'
into 'build/asciidoc/docbook45/assets'
}
task copyAssetsDB5(type: Copy) {
from 'src/docs/asciidoc/assets'
into 'build/asciidoc/docbook5/assets'
}
task gen(dependsOn: ['copyAssetsPDF', 'copyAssetsHTML5', 'copyAssetsDB45', 'copyAssetsDB5', 'asciidoctor']) << {
println "Files are generated."
}