Created a new Gradle plugin to publish to Maven Ce...
# community-news
s
Created a new Gradle plugin to publish to Maven Central via the new Maven Central Publishing API: https://github.com/SgtSilvio/gradle-maven-central-publishing I know that there are already some plugins out there, but many seem to be unfinished or doing more things than they should imho. This plugin does not require its own DSL configuration. If you already have the maven-publish and signing plugins configured, you only need to configure 2 Gradle properties for the Maven Central Portal credentials. The publishing tasks are named with a similar scheme than the tasks created by the maven-publish plugin:
publishToMavenCentral
and
publish<PublicationName>PublicationToMavenCentral
y
Is this for accounts that publish via Central Portal or legacy OSSRH ?
s
via the Central Portal
y
I think it would be worthwhile to state that clearly as
Copy code
You need to create a user token for the Maven Central portal: <https://central.sonatype.com/account>.
does not clarify that. (Anyway I think a lot of newer publishers might thank your for this new plugin).
s
Thanks for the feedback, added a note to the top of the readme.
1
o
Out of curiosity, what would be the difference from https://github.com/vanniktech/gradle-maven-publish-plugin ? IIUC it now supports new Nexus APIs, and should work with Maven Central as of 0.28
s
I have looked through many existing plugins, and many are
doing more things than they should imho
For example, providing custom DSLs for configuring pom metadata, being opinionated when it comes to signing, etc. I won’t say that these plugins aren’t useful, but imo this should be solved via composition, so multiple plugins, each solving one thing. With this plugin, I tried to be unopinionated, only implementing the Maven Central Portal Publisher API with integration of other plugins in mind (core gradle plugins and third-party plugins such as https://github.com/SgtSilvio/gradle-metadata).
💯 1
This plugin is also compatible with the configuration cache, seems there are some issues for the plugin you linked. (which is probably also caused by implementing multiple things (nexus publishing and the new portal API) in a single plugin)
Also, the plugin you linked does not seem to wait for the publish status of the new API to reach VALIDATED, PUBLISHING or PUBLISHED. At least the first one is required to determine if a publish task was successful.