Reputation: 3930
I have task war configuration with many from/include/exclude
:
task war {
exclude
exclude
...
into ... from ...
into ... from ...
}
I have another task war configuration which is the same except one exclude
.
I don't want to duplicate those configurations. How can I reuse the first configuration?
Upvotes: 2
Views: 809
Reputation: 3930
ext.sharedWarConfig = { task->
configure(task) {
from ... include ...
}}
task warWithoutFile(type: War) { task ->
sharedWarConfig(task)
exclude ...
}
task warWithFile(type: War) { task -> sharedWarConfig(task) }
jettyRunWar {
dependsOn warWithFile
dependsOn.remove("war")
webApp = warWithFile.archivePath
}
Upvotes: 2