Gradle plugin packaged by Maven

Hi all,

I’m trying to implement a Gradle plugin in Java but using Maven to build and publish plugin as opposed to example Gradle plugins using Gradle.

Dependencies. Gradle plugin built with Gradle usually has just one dependency implementation(gradleApi()) that brings all of gradle core libs from the gradle version used by the project. If I use maven to build the project i have to bring in a number of org.gradle:gradle-xxx-xxx dependencies found in the repo: JFrog. The issue is that all these libs have 6.1.1 version as the latest in the repo. Does this look right? I was under the impressions that it should be 8.5

Publishing. Is it possible to publish a Gradle plugin artifact built with Maven to the Gradle Plugin Portal?

It’d be awesome if you could point me an example of a Gradle plugin built with Maven somewhere in Github :slight_smile:

Thanks in advance!

Cheers,
Alex

gradleApi(...) is not an external dependency but a shipped thing built into the Gradle distribution.

Once this issue is resolved it might be available as external dependency: Improved support for plugins targeting multiple Gradle versions · Issue #70 · gradle/build-tool-roadmap · GitHub

In the meantime you might want to use the repackaged jars from Gradle plugin development as your dependency.

Publishing to the portal is probably problematic. The only way I know is the closed source obfuscated Gradle plugin. Maybe with enough effort your somehow could abuse it, but no idea.

You could just publish to Maven Central, as the portal delegates to it for things it does not host itself, but you will then not find it on the web frontend of the portal.

In any way, don’t forget to also build and publish the marker artifact, or using the plugin is much harder than it should be: Using Plugins

It is probably much easier if you use Gradle to build and publish your plugin module and delegate from Maven to Gradle if you insist on using Maven as primary build tool, especially if you want to publish to the portal directly.

Thank you very much!!!

1 Like