Some weeks ago I tried to get help for a problem (How to publish different build artifacts from the same subproject?). Sadly, I got no answer.
After retrying to solve my problem, I come to the opinion that there is a bug in the Maven publishing implementation.
The docs say “Clears any previously added artifacts from MavenPublication.getArtifacts() and creates artifacts from the specified sources”.
In my subproject I’m overwriting publishing with this
artifacts = [ serverJarWithoutAnnoProfile ]
Which means, for my understanding: publishing should just take the artifact from the task ‘serverJarWithoutAnnoProfile’. The expected jar from this task is built by the task, but not this jar is uploaded; instead publishing uploads the regular jar for this subproject which is not what I expect it to do.