我有许多 from/include/exclude
任务战配置:
task war {
exclude
exclude
...
into ... from ...
into ... from ...
}
我有另一个任务 war 配置,除了一个exclude
之外是相同的。
我不想重复这些配置。如何重用第一个配置?
最佳答案
尝试:
ext.sharedCopyConf = { task, to ->
configure(task) {
into to
from 'a'
}
}
task copy1(type: Copy) { t ->
sharedCopyConf(t, 'b')
}
task copy2(type: Copy) { t ->
sharedCopyConf(t, 'c')
}
看看 demo .
关于gradle - 如何在 Gradle 中重用任务配置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37713363/