Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish gradle plugin to maven central #3719

Closed
coopstah13 opened this issue Aug 2, 2022 · 7 comments
Closed

publish gradle plugin to maven central #3719

coopstah13 opened this issue Aug 2, 2022 · 7 comments

Comments

@coopstah13
Copy link

Environment:

  • 3.2.1
  • Gradle 7.4.2
  • Linux

Description of the issue:
I would like to use precompiled script plugins with jib as documented here: https://docs.gradle.org/current/userguide/custom_plugins.html#applying_external_plugins_in_precompiled_script_plugins

The problem is there is no way for me to declare the dependency to the jib gradle plugin as it isn't published (the maven plugin is though).

Expected behavior:
The plugin is published as an artifact to maven central

Steps to reproduce:
See above link

@zhumin8
Copy link
Contributor

zhumin8 commented Aug 2, 2022

The gradle plugin is published to the gradle repository here: https://plugins.gradle.org/plugin/com.google.cloud.tools.jib

@coopstah13
Copy link
Author

I don't think that is enough. I need to be able to reference it as a dependency, as in the link above.

@coopstah13
Copy link
Author

in the example from my link:

dependencies {
    implementation 'com.bmuschko:gradle-docker-plugin:6.4.0'
}

This plugin is published to maven central with those coordinates. Similarly, jib would need to be published to maven central as the maven plugin is today. https://search.maven.org/artifact/com.google.cloud.tools/jib-maven-plugin/3.2.1/maven-plugin

@chanseokoh
Copy link
Member

chanseokoh commented Aug 2, 2022

Particularly for Gradle, it doesn't matter where an artifact is published. If it's on Maven Central, you would declare mavenCentral(). If on the Gradle Plugin Portal, you would declare gradlePluginPortal(), but that's even unnecessary because the repo is available by default. In fact, the Gradle Plugin Portal is a Maven repo, so you could even declare maven { url "https://plugins.gradle.org/m2/" }, which is again unnecessary.

So you should have no problem accessing it. The Maven coordinates are gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.2.1 for versions before 3.3.0 and com.google.cloud.tools:jib-gradle-plugin:3.3.0 for >=3.3.0.

However, I wonder why you want the Jib Gradle plugin, as it is not intended to be consumed as a library but as a plugin. Could Jib Core library be the right choice?

@coopstah13
Copy link
Author

OK, so the piece that makes it work is declaring gradlePluginPortal() in repositories. It cannot otherwise resolve the plugin (I confirmed by adding and removing it). The point is to be able to define jib configuration centrally and reuse it in a multi-module project. Gradle lets you define build scripts and then apply them as plugins (check the link). I'll close this because it works if I add the plugin repository.

@chanseokoh
Copy link
Member

So you should have no problem accessing it. The Maven coordinates are gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.2.1.

For some unknown reason, the coordinates with the prefix gradle.plugin are no longer valid starting with 3.3.0. com.google.cloud.tools:jib-gradle-plugin:3.3.0 without the prefix works though, which actually looks better.

@hfhbd
Copy link

hfhbd commented Sep 11, 2022

For some unknown reason, the coordinates with the prefix gradle.plugin are no longer valid starting with 3.3.0. com.google.cloud.tools:jib-gradle-plugin:3.3.0 without the prefix works though, which actually looks better.

The coordinate change was the result of updating the gradle publish plugin #3701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants