mavenPublish_ method setArtifacts not working as expected

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. :frowning:

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

publishing.publications {
mavenJava(MavenPublication) {
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.