When running a task generated by the maven-publish
plugin, for example publishMyPublicationToMyRepository
, the output of this task appears before the task name in the console.
In the following sample of console output, the record of an artifact being uploaded appears first :
$ gradle publishMyPublicationToMyRepository
...
Upload http://<repo>/<project>/maven-metadata.xml.md5
> Task :publishMyPublicationToMyRepository
Print statements manually added to the task’s execution phase print where I’d expect them:
tasks.withType(PublishToMavenRepository) { task -> doFirst { println "execution $task.name" }
$ gradle publishMyPublicationToMyRepository
...
Upload http://<repo>/<project>/maven-metadata.xml.md5
> Task :publishMyPublicationToMyRepository
execution publishMyPublicationToMyRepository
Bumping up the log level to INFO, I can see that there is a thread that is started to handle to uploading, and it appears that this is where the premature output comes from:
$ gradle publishMyPublicationToMyRepository
...
:publishMyPublicationToMyRepository (Thread[Task worker for ':',5,main]) started.
...
Upload http://<repo>/<project>/maven-metadata.xml.md5
> Task :publishMyPublicationToMyRepository
...
Uploading: <project>/maven-metadata.xml to repository remote at <repo>
execution publishMyPublicationToMyRepository
:publishMyPublicationToMyRepository (Thread[Task worker for ':',5,main]) completed
Is this a bug? Is there a way to reorder the output from the worker thread so that it appears after the task name in console ouput?