Matthew Von-Maszewski
09/03/2025, 3:46 PMtasks.create(name: 'dist', dependsOn: subprojects.publishInternal) {
Often execute "./gradlew dist". Sometimes execute "./gradlew clean dist". The latter works fine until setting "org.gradle.parallel=true". What is the correct way to say dist must execute after clean if and only if clean is being executed?René
09/03/2025, 3:48 PMtasks.create(name: 'dist', dependsOn: subprojects.publishInternal) {
mustRunAfter 'clean'
}
should be good enoughMatthew Von-Maszewski
09/03/2025, 3:52 PMVampire
09/03/2025, 4:48 PMsubprojects.publishInternal
gets some task from the subprojects or similar. That is almost as bad as doing cross-project configuration.
And also you should practically never use tasks.create
as you then do not leverage task-configuration avoidance, but tasks.register
.
And the mustRunAfter
will not really help either.
Because you define that dist
in that project must run after clean
in that project.
But you do not say anything about the tasks that actually are your problem.
Tbh, this question makes me feel like you should do a major overhaul of your build logic. 🙂Matthew Von-Maszewski
09/03/2025, 5:28 PMVampire
09/03/2025, 6:04 PMVampire
09/03/2025, 6:04 PM