Not including OS information because I don’t think it’s relevant.
Basically, my experience with various tools that publish to maven repositories, including the “uploadArchives” task from the “maven” gradle plugin (which if I understand correctly maven-publish is intended to supplant in the future), supports configuration of different repository policies for “release” vs “snapshot” artifacts.
Since it seems to me like being able to make this distinction is pretty standard behavior for tools that publish to maven repositories, I suspect it would be helpful for users transitioning to Gradle and the maven-publish plugin to be able to do something similar without being required to reinvent the logic (simple as it is) or copy-paste it from examples found in other projects.
It’s possible that I simply missed the “release” vs “snapshot” configurability somewhere in the documentation or API docs, but it doesn’t seem likely. Also, I’m not sure if this should be a “bug” or “feature request” or if I should have signed up for the gradle JIRA to file a ticket directly.
Wayne, my apologies—I was a bit hasty in my response. I realize now that you’re already aware of the approach I listed above, and you’re asking about its equivalent in the maven-publish plugin.
Unfortunately the answer is that there isn’t a first-class equivalent, meaning that your options are (1) to, as you put it, “re-invent the logic”, e.g. by wrapping conditional blocks around the relevant parts of the DSL, or (2) to continue using the older maven plugin for now.
We are aware of these issues and plan to address them, but that work is not underway yet. I’ve made a note of this post in our plan for that work to remind ourselves about it when we do begin. Thanks.