https://kotlinlang.org logo
Title
d

Dariusz Kuc

05/06/2020, 5:32 AM
hello! is there a way to finalize root module task AFTER all child modules finish their tasks? e.g. would like to finalize
publish
with
closeAndReleaseRepository
(from
gradle-nexus-staging-plugin
) but it needs to run after ALL modules finish publishing their artifacts. Currently I’m explicitly running
gradle publish closeAndReleaseRepository
but wondering whether there is a better way
c

cristiangm

05/06/2020, 5:37 AM
There is no
publish
in the root module, when you call:
./gradlew publish
you are just executing publish on all the Gradle modules
d

Dariusz Kuc

05/06/2020, 5:41 AM
well my
dependsOn
clause for root
publish
works fine (i.e.
initializeSonatypeStagingRepository
)
but yeah there are no artifacts for root to be published
c

cristiangm

05/06/2020, 5:43 AM
It seems you are applying the publishing plugin to the root project, so, yes, you have a publish task (that does nothing) at the root
d

Dariusz Kuc

05/06/2020, 5:46 AM
So there is no clean way of updating build to finalize publish after all modules are published
c

cristiangm

05/06/2020, 5:46 AM
I was looking for the documentation but I don't find it, Gradle suggests exposing a configuration from the projects and consuming it from the root in your case..
That's the thing, different tasks on different projects... You could declare a task on the root that depends on all the projects and is finelizedBy the close
d

Dariusz Kuc

05/06/2020, 5:47 AM
I guess
Eh i think i'll keep explicit task invocation for publish + closerepo
1
Thanks!
c

cristiangm

05/06/2020, 5:49 AM
BTW does anything enforce the order of the task or may it run before the publish finished?
d

Dariusz Kuc

05/06/2020, 2:03 PM
i guess its just gradle running tasks in order they are specified