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 plugin to the Gradle Plugins Portal #80

Merged
merged 3 commits into from
Jan 19, 2021
Merged

Publish plugin to the Gradle Plugins Portal #80

merged 3 commits into from
Jan 19, 2021

Conversation

chadlwilson
Copy link
Contributor

Motivation

Use of the plugins DSL is much more concise and seems to be the way forward for Gradle. With the removal of need for Jitpack in #77 this appears to be easier now.

Resolves #36.

Changes made

  • Followed guide here and here to add the requisite metadata into the plugin.
  • Included mavenCoordinates as my reading indicates we might need this since the plugin is already being published to bintray
  • Added an additional deployment into the Travis build
  • Updated the README to indicate how to use either approach

For team to do

  • Register with https://plugins.gradle.org/user/register
  • Get API keys into Travis
  • If you could possibly publish an RC build (e.g. 0.9.1-rc1) I can help test it. I initially updated the samples too; but probably better to have a build published first before we do that.

@coveralls
Copy link

coveralls commented Mar 18, 2019

Coverage Status

Coverage remained the same at 92.63% when pulling c5bcfc3 on chadlwilson:feature/gradle-plugin-publish into 17576a4 on ePages-de:master.

@mduesterhoeft
Copy link
Contributor

mduesterhoeft commented Mar 18, 2019

Thanks for the PR. I will have a closer look tonight. It is really much better to go for the plugins block. This was just something that got a little bit out of sight. So thanks for bringing it up.

@mduesterhoeft
Copy link
Contributor

mduesterhoeft commented Mar 18, 2019

I have some issues publishing the plugin - I did not find a hint on how to solve this. Please see https://discuss.gradle.org/t/problems-publishing-an-existing-gradle-plugin-to-the-plugin-portal/31012?u=mduesterhoeft

@chadlwilson
Copy link
Contributor Author

Ugh, yeah, that's a pain. I wonder if it's related to the mavenCoordinates section. Not sure how to address that bit.

@mduesterhoeft
Copy link
Contributor

I also tried without the mavenCoordinates but the error persists

@chadlwilson
Copy link
Contributor Author

Is there any way you think we could unblock this?

If we can't get ownership of com.epages, how about using de.epages?

@chadlwilson
Copy link
Contributor Author

@mduesterhoeft Any chance of having another go at this?

There are some docs at https://plugins.gradle.org/docs/reclaiming for how to "claim" plugin/account and instructions of how to contact the admins via https://plugins.gradle.org/docs/get-help. Although this situation seems a little different, it does seem the process is to go via their Contact Us page?

@UgmaDevelopment
Copy link
Contributor

Thanks for all the hard work on this issue. Was there ever any word back?

@ozscheyge
Copy link
Contributor

Not that I'm aware of @UgmaDevelopment , this seems to be stuck.

@chadlwilson
Copy link
Contributor Author

Can it perhaps just be published to a different location somehow as I suggested above (within Gradle Plugins portal) so we can move forward with current Gradle approaches to consuming plugins? :-/

@ozscheyge ozscheyge self-assigned this Dec 18, 2020
@ozscheyge
Copy link
Contributor

I'll have a look and will try to resolve this @chadlwilson

@ozscheyge
Copy link
Contributor

> Task :restdocs-api-spec-gradle-plugin:publishPlugins FAILED
Could not reuse POM from pluginMaven publication because mavenCoordinates() was used
Publishing plugin com.epages.restdocs-api-spec version 0.9.9-SNAPSHOT

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':restdocs-api-spec-gradle-plugin:publishPlugins'.
> Failed to post to server.
  Server responded with:
  The user 'epages-dev' does not have write permissions to plugin [com.epages.restdocs-api-spec]

Trying to claim now.

@ozscheyge
Copy link
Contributor

Seems like https://github.com/gradle/plugin-portal-requests/issues?q=is%3Aopen+is%3Aissue is the current way to claim groupIds. I'll prepare a request

@ozscheyge
Copy link
Contributor

gradle/plugin-portal-requests#73 worked like a charm:

> Task :restdocs-api-spec-gradle-plugin:publishPlugins
Could not reuse POM from pluginMaven publication because mavenCoordinates() was used
Publishing plugin com.epages.restdocs-api-spec version 0.9.9-SNAPSHOT
Thank you. Your new plugin com.epages.restdocs-api-spec has been submitted for approval by Gradle engineers. The request should be processed within the next few days, at which point you will be contacted via email.
Publishing artifact build/libs/restdocs-api-spec-gradle-plugin-0.9.9-SNAPSHOT.jar
Publishing artifact build/libs/restdocs-api-spec-gradle-plugin-0.9.9-SNAPSHOT-sources.jar
Publishing artifact build/libs/restdocs-api-spec-gradle-plugin-0.9.9-SNAPSHOT-javadoc.jar
Publishing artifact build/publish-generated-resources/pom.xml
Activating plugin com.epages.restdocs-api-spec version 0.9.9-SNAPSHOT

BUILD SUCCESSFUL in 2m 7s
25 actionable tasks: 2 executed, 23 up-to-date

Now waiting for approval:

Screenshot from 2021-01-15 15-09-23

@chadlwilson
Copy link
Contributor Author

Great news @ozscheyge ! Thanks for following up on this :-)

@ozscheyge
Copy link
Contributor

The gradle plugin has been approved:

plugins {
  id "com.epages.restdocs-api-spec" version "0.9.9-SNAPSHOT"
}

So far, that's only the version I published from my machine. I'd merge this, configure Travis and check the other follow-ups @chadlwilson mentioned.

@ozscheyge ozscheyge merged commit 11080ea into ePages-de:master Jan 19, 2021
@ozscheyge
Copy link
Contributor

ozscheyge commented Jan 19, 2021

For future reference:

Adding secrets to travis config ( https://docs.travis-ci.com/user/encryption-keys/ ):

gem install travis
# Inside the repo directory
travis encrypt SOMEVAR="secretvalue"

Mapping environment variables to gradle.properties ( https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties ), so the follow two env vars need to be encrypted using the above method:

GRADLE_PUBLISH_KEY
GRADLE_PUBLISH_SECRET

edit: doesn't quite work, yet: gradle/gradle#1246

@ozscheyge
Copy link
Contributor

ozscheyge commented Jan 19, 2021

https://plugins.gradle.org/plugin/com.epages.restdocs-api-spec

da98029
Eventually it worked, 0.10.3 is currently first and latest version published to the Gradle plugins portal.

@chadlwilson
Copy link
Contributor Author

Thanks @ozscheyge !

New published plugin seems to be working fine - was able to remove our settings.gradle hack.

// Workaround until restdocs-api-spec is published to Gradle Plugins Portal per https://github.com/ePages-de/restdocs-api-spec/issues/36
pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "com.epages.restdocs-api-spec") {
                useModule("com.epages:restdocs-api-spec-gradle-plugin:${requested.version}")
            }
        }
    }
}

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

Successfully merging this pull request may close these issues.

Plugin not found when using the new Plugin DSL notation in build.gradle
5 participants