Slackbot
06/22/2022, 4:49 AMVampire
06/22/2022, 7:48 AMartifactoryPublish that you are configuring there.
This should also fail in Groovy DSL if there is no such task as soon as this build script is evaluated.
Can you provide an MCVE where you show what exactly you have with the Groovy DSL?Sid B
06/22/2022, 2:14 PMVampire
06/22/2022, 2:23 PMtasks
.withType<ArtiractoryPublishOrWhatTheTypeOfTheTaskIs>
.matching { it.name == "artifatoryPublish" }
.configureEach {
publications(...)
}
where you can even omit the isCI check, as it is only done if a task with that name and of that type is found.
Do not omit anything like not doing the type-check and directly matching on the name or you will totally break task configuration avoidance as all tasks going through matching have to be realized. Like it is written at least only tasks of the specified type are always realized if present.Sid B
06/23/2022, 1:47 PMtasks.withType<ArtifactoryTask>
Shouldn't I have to import the ArtifactoryTask here?Vampire
06/23/2022, 1:50 PMVampire
06/23/2022, 1:50 PMVampire
06/23/2022, 1:51 PMwithGroovyBuilder for example, or writing that logic in a Groovy file that you apply from.
But actually that'a a sacrifice imho.
One of the big pros of the Kotlin DSL is, that it is typesafe and provides proper IDE support.