Upload artifact to Plugin portal without plugin

Hello, I am building a project of several artifacts with Maven and recently developed a Gradle plugin. Unfortunately, this was a bit tricky to do. I integrated the Gradle plugin by running Gradle from Maven which is however limited as new artifacts are not yet available in any repository. Therefore, I reattach the results of the triggered Gradle build to Maven and take it from there such that the artifacts end up in both JCenter and Maven Central.

Ideally, I would like to use a script to also deploy the artifacts to the Plugin repository. Is there a standard API to use for uploading a ready-made artifact without needing to use the designated Gradle plugin? I do not want to further complicate my build.

Ideally, I would like to build the Gradle plugin with Maven altogether. This would require:

a) Adding the Gradle plugin API to Maven Central.
b) Supplying a build plugin to also deploy the artifact to the Plugin repository.

I understand that this might not be a priority for you but the majority of my users is using Maven, I need to give this precedence.

Hi Rafael,

there is no need to publish your Gradle plugin to Maven Central or JCenter, so I don’t fully understand the initial problem.

Plugins should only be published to the plugin portal.


The problem is that I cannot publish a Gradle plugin via Maven so publishing it to JCenter and Maven Central is the next best thing I got working. I would however ignore the artifact from publication in the Maven build if I was able to publish an artifact directly to the Plugin Portal. I understand that the latter is the way to go but currently it does not seem to be possible without sacrificing the consistency of my build.

Could you elaborate why you can’t build and publish the plugin with Gradle?

Because I already have a rather complex build set-up that relies on Maven: https://github.com/raphw/byte-buddy

I managed to integrate building the plugin into this build but the built artifact is not available in any repository during the release phase which is why I need to reference the dependency to the main project locally. This makes it impossible to trigger the release from Gradle even if I bound the Maven release goal to the Gradle release task.

I think the easiest solution would be to manually transport the artifact via a script at the end of the build.

I understand the problem now, thanks!

My suggestion would be to create a dummy Gradle build for your core project which only takes the jar built by Maven and exposes it as its main artifact. Roughly like this:

apply plugin: 'base'

group = 'your.group.id '
version = 'your.version'

artifacts {
  'default' file('target/core.jar')

You then include it in your settings.gradle like this:

includeFlat 'core'

Now you can use a project dependency in your plugin’s build.

dependencies {
  compile project(':core')

This will

  • pick up the jar built by Maven
  • publish the correct dependency metadata (a dependency on your.group.id:core:your.version)

Hope that helps :slight_smile:

Great, thanks for the suggestion. I will try to incorporate this some time!

One last question: Will the Gradle plugin release process also upload the dependency to the plugin repository or does it rely on the linked dependencies?

It will only upload your actual plugin. It’s dependencies need to be on JCenter or Maven Central.

1 Like