Coming up on needing to start publishing directly to Maven Central due to the Bintray sunset. Our main project is currently using uploadArchives/MavenDeployer
in order to publish already built artifacts, including POMs to OSSH snapshots. This is accomplished by loading up a configuration, and then setting that on uploadArchives
. Easy peasy.
It’s a pretty straight shot to just wire the credentials and stuff for OSSHR proper and pop the nexus staging release plugin in, but I figured I’d look into publishing and get upgraded to doing it proper.
Wow, I had no idea what I was in for. Is it just me or does the publishing system, and maven-publish, not feel very idiomatic Gradle? It’s got all this fancy stuff going on with components and variants and meta, but as soon as you want to do something custom, even something very simple but requiring a little flexibility, the whole thing crashes down on you:
- Doesn’t work with configurations best I can tell(can’t figure out how to get it to lazy resolve their artifacts)
- Does work with task outputs(?!)
- Seems to hang everyone up with the dynamic task name, lack of DSL
dependsOn
, and a frustrating inability to get things configured outside of the configuration phase(I can’t toss it in adoLast
apparently or everything explodes) - Doing anything custom seems to require delving into Component extensions and/or custom plugins(has to be a plugin the docs say). It’s not super clear if this is a viable path forward or just going to end up a time sink.
- Seems SUPER opinionated about workflow; a throwback to yester-Gradle
I mean, I’ve written some plugins. Gone spelunking into the Gradle source depths(and Bintray plugin, and Grails plugins, and etc etc). But I don’t think anything has frustrated me more with Gradle than trying to get Publishing to do something outside its narrow imagination.
Searching the forums for potential solutions I mostly ran across people who threw in the towel and went back to uploadArchives
or scripts external to Gradle!
So, publishing has been the new hotness for, what, almost a decade now? It really does feel like a throwback to when Gradle had tons weird rough edges baked into the DSL due to a dogmatic use-case perspective(sorry, I had to rework this sentence and this was the best I could come up with…). IIRC correctly a focus over the past few years was breaking out of the “Conservative Java Shop” box. Is the legacy publishing, deprecated for as far back as my Gradle memory goes, every really going away? Is it telling that it hasn’t?
Tomorrow, like those who came before me(such as the one attempting something seemingly simple like publishing a dynamic list of RPM files), I’m going to fall back on uploadArchives
and get back to working on stuff that produces value