Using plugins{} mechanism with Maven Central

plugins

(Marcin Zajączkowski) #1

Hi. I publish my plugin to Maven Central (as the ultimate source of JAR artifacts). However I would like to have it available through the “new”, shorter plugin applying mechanism plugins {}. I would prefer not to use plugin-publish as it seems to generate artifacts on its own and the artifacts in Maven Central & Gradle Portal could not be exactly the same.

I’ve seen pluginRepositories {} configuration mechanism, unfortunately when pointed to Maven Central for my plugin with id “info.solidsoft.pitest” is looks for an artifacts with groupId: info.solidsoft.pitest and artifactId: info.solidsoft.pitest.gradle.plugin which doesn’t correspond to the real one in Maven Central.

Is it possible to override Maven coordinates when the plugins {} mechanism is used (like with mavenCoordinates {} in plugin-publish plugin)? Maybe I can do it in some other way?


(Stefan Oehme) #2

Hey Marcin,

all community plugins should be published to the plugin portal, not to Maven Central. This way both you and your users will get it working out of the box.

Cheers,
Stefan


(Marcin Zajączkowski) #3

Portal Plugin is very handy, however I don’t want to resign from having my artifacts available (also) in Maven Central. For example, I know corporations that have limited access to artifacts outside Maven Central and people there have to struggle with things available only via Bintray/jCenter.

Can you propose something which would allow to simply keep artifacts in both repositories?


(Stefan Oehme) #4

You can publish to Maven Central as well, the artifact will be the same.

I’m curious though, why would a corporation that has chosen Gradle as their build system block access to plugins.gradle.org?


(Marcin Zajączkowski) #5

AFAIR plugin-publish has its own tasks to build (assemble) the artifacts. I would like to have them exactly the same.

I could take a look at the plugin-publish plugin to modify it to reuse already built artifacts (it by providing groupId, artifactId and version - to resolve its (using standard resolution mechanisms) from local Maven repo or Maven Central) and upload it to the portal with overridden coordinates. Would you accept a PR with that changes (if I was able to implement it)?

Regarding that company, Maven is a standard there (and Maven Central is usually enough for them). However, there are people wanting to change it by providing PoC with Gradle and they are facing access issues.


(Stefan Oehme) #6

That’s not the case. You can apply both the plugin-publish plugin and the maven or maven-publish plugin and they will publish the same jar built by the jar task.


(Marcin Zajączkowski) #7

You were right. Thanks.