Skip to content

Publish Gradle plugin to plugins.gradle.org #282

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

Closed
ben-manes opened this issue Jan 30, 2015 · 10 comments · Fixed by #1466
Closed

Publish Gradle plugin to plugins.gradle.org #282

ben-manes opened this issue Jan 30, 2015 · 10 comments · Fixed by #1466
Milestone

Comments

@ben-manes
Copy link
Collaborator

This should be done for discoverability to promote js2p and has no functionality changes. It is required if using the new plugin DSL, but that's not used in practice yet.

The steps appear minimal. It does require changing to the new Gradle plugin naming convention, so there is a little upgrade pain.

JCenter is a two-way mirror of Maven Central. Ideally this requires a small change to the build while still publishing as usual. If the new attributes can only be provided if publishing to JCenter directly, then this won't be worth the effort.

@Chessray
Copy link

Chessray commented Aug 23, 2018

Is there any work happening in this space? This plugin is the only reason for us to use the dreaded

buildscript { repositories { ... } dependencies { ... } }

block on my current project. We'd really like to be able to use the plugin DSL for this gem as well.

@marekjagielski
Copy link

Are there any plans for adding plugin to Plugin Portal?

@Enigamitsuj
Copy link

Had a similar issue here is how I solved it. Voting this up!
https://stackoverflow.com/questions/51766423/cant-use-jsonschema2pojo-gradle-plugin-in-plugins-block

@EAlf91
Copy link

EAlf91 commented Dec 8, 2022

@Enigamitsuj solution works, but is another workaround. Any plans to work on this?

@joelittlejohn
Copy link
Owner

I've published v1.1.3 to plugins.gradle.org. There's a problem somewhere but I've been unable to track it down yet.

When I use legacy plugin application then I can use the plugin successfully. When I use the newer plugin DSL then I see this error:

* What went wrong:
Could not apply requested plugin [id: 'org.jsonschema2pojo', version: '1.1.3'] as it does not provide a 
plugin with id 'org.jsonschema2pojo'. This is caused by an incorrect plugin implementation. Please 
contact the plugin author(s).
> Plugin with id 'org.jsonschema2pojo' not found.

Clearly there is something not quite right with the metadata, or there is some conflict with what is published to plugins.gradle.org and what is published to Maven Central. Unfortunately Gradle doesn't give much useful info (this is the exception).

Should be easy to fix I'm sure. I will leave the plugin published for now (for diagnostic purposes), but will take it down within 7 days if I don't resolve the problem.

@ben-manes
Copy link
Collaborator Author

ben-manes commented Feb 8, 2023

At some point Gradle deprecated being able to use unqualified plugin ids like jsonschema2pojo except for internal plugins and adopted reverse domain names. Since this plugin predates that I am guessing it is beyond the sunset period (as plugin block came even later) so it is rejected. I believe you would just need to bite the bullet and force users to update.

@ben-manes
Copy link
Collaborator Author

ben-manes commented Feb 8, 2023

For another plugin, we did the switch in 2014 🙂

Sorry, I misread and you switched over.

@unkish
Copy link
Collaborator

unkish commented Feb 9, 2023

plugins {
    id 'java'
    id "org.jsonschema2pojo" version "1.1.3"
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
}

test {
    useJUnitPlatform()
}

as well as

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:1.1.3"
    }
}

plugins {
    id 'java'
}

apply plugin: "org.jsonschema2pojo"

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
}

test {
    useJUnitPlatform()
}

Worked for me 🤔 (gradle 7.5.1)
Ran them extra with -g /path/to/temp_repo to make sure that "clean" repository would be created/used.

@ben-manes
Copy link
Collaborator Author

ben-manes commented Feb 13, 2023

I was able to reproduce the problem. The issue is the ordering of buildscript repositories. If Maven Central is the first on the list then the plugin id does not resolve. If the Gralde Plugin Portal is the first then it does. The released artifact metadata differs between the repositories (central id jsonschema2pojo, portal id org.jsonschema2pojo) and is causing resolution the difference.

@joelittlejohn
Copy link
Owner

Ah yes, so the jar on Central contains this:

image

and the jar on portal contains this:

image

Looks like we just need the org.jsonschema2pojo.properties present in the Central jar. Should be trivial to fix.

Thanks for investigating @ben-manes !

@joelittlejohn joelittlejohn added this to the 1.2.0 milestone Feb 14, 2023
@joelittlejohn joelittlejohn changed the title Add to Gradle Plugin Portal Publish Gradle plugin to plugins.gradle.org Feb 14, 2023
@joelittlejohn joelittlejohn modified the milestones: 1.2.0, 1.1.3 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants