I’m working on publishing artifacts for my Gradle PIT plugin to Maven Central. I was able to configure publishing artifacts using maven-publish and separately signing artifacts with signing plugin, but I have problem how to combine it together.
How can I tell maven-publish plugin to upload also artifacts signatures available in build/lib directory as .asc files?
It’s not yet possible to upload artifact signatures via the new maven-publish plugin. The problem is that there’s no way to tell Gradle that the ‘.asc’ file is not a regular artifact but is in fact auxiliary to the main artifact.
…but it requires a weird hack of publishing twice. I see there’s now a task called “generatePomFileForJavaPublication”, which I guess takes care of the hack part.
I’m using the nebula-publishing-plugin (https://github.com/nebula-plugins/nebula-publishing-plugin) to publish to a Maven repo (bintray) with signatures. It incorporates the ideas in the blog you pointed to. It’s used by all nebula-plugins.
It’s kind of crazy that this has not been incorporated into the ‘maven-publish’ plugin yet. It’s literally basic functionality required to publish to Maven Central. Your comment is over a year old, has there been any progress on this?
If not, I suggest you make it significantly clearer in the documentation for the “new” plugin that it does not work with Maven Central deployments.
Hey Justin, I’ve seen the nebula-publishing-plugin and I’ll probably switch over and use it.
I just find it strange that the documentation for the “maven-publish” plugin does not make it clearer that it doesn’t work with the “signing” plugin to upload to Maven Central.
Essentially everyone coming to Gradle finds the new “maven-publish” plugin and attempts to use it with Maven Central only to find that ‘.asc’ signatures are not uploaded and therefore the uploaded artifacts do not pass all the validation rules, this is followed by searching around online for a while and finding a year old post about how it’s “on the roadmap”.
Just to clear things up. When Googling I ended up in this thread and at first thought
publishing with .asc files was impossible. It is however, possible and very easy.
With gradle 2.6 publishing to Maven Central with .asc files works out of the box.
Both plugins ‘maven’ and ‘signing’ are needed properly configured.
All the information was on the following documentation pages.
@Pelam Please read my original post carefully. The question is about publishing artifacts signatures using the (then) new maven-publish plugin (which still - after a few years - has a few major limitations). I haven’t seen any release notes regarding that case in maven-publish plugin, so I assume the situation hasn’t changed. Nevertheless your links point to the old maven plugin which is known to work properly with asc files (and which I have been using for years), but unfortunately also has some limitations.
Is there any update to this? I’ve got a reasonably complex setup based on the ‘maven-publish’ plugin that I want to publish to Maven central. I just need to satisfy the signing requirement. Am I really going to have to port all my configuration to the old ‘maven’ plugin just to sign my artifacts?
I’d have to agree that it’s very frustrating that you can’t sign artifacts with the Maven publish plugin. The functionality still hasn’t been implemented in the meantime. Unfortunately, the work never made it to the top of the priority list. I recently created the following issue to track the functionality: https://github.com/gradle/gradle/issues/1165. I’d love to see a pull request for the feature and would be happy to help getting it over the finish line. Please also vote for the issue on GitHub so we can prioritize it higher internally.