You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Could not apply requested plugin error when using version 1.3.1 of Gradle plugin 'org.jsonschema2pojo' #1769
Upgrading to 1.3.0 worked fine. But setting the version to 1.3.1 and doing a Gradle-refresh provides this error:
Could not apply requested plugin [id: 'org.jsonschema2pojo', version: '1.3.1'] 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.
Thanks for raising this! I had to resolve a duplicate resource problem and it appeared that a file was not needed, but clearly it was. I'm surprised that our 'example' project did not pick this up.
I actually can't replicate this issue @NilsDammenhayn@digsim. I've tried with 1.30 and 1.3.1, using both Gradle 8.9 and Gradle 9.3.1. Could you show us how you are using the plugin in your build.gradle? Or provide a minimal example as @unkish says?
I'll try to provide a minimal example this evening after work. We use the plugin like
plugins {
id "org.openapi.generator" version "${OPENAPI_GENERATOR_VERSION}"
id "java" // required for jsonschema2pojo
id "org.jsonschema2pojo" version "${JSONSCHEMA2POJO_VERSION}"
}
...
...
// All parameters: https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin
jsonSchema2Pojo {
// /!\ The files need to be in different sub-folders in the specs/jsonschemas folder in order to have different
// packages to avoid name conflicts
source = files("$rootDir/specs/jsonschemas")
targetDirectory = project.layout.buildDirectory.dir("generated/js2p").get().asFile
targetPackage = 'com.acme.model'
useBigDecimals = true
useJakartaValidation = true
targetVersion = "21"
dateType = "java.time.LocalDate"
dateTimeType = "java.time.LocalDateTime"
formatDateTimes = false
includeHashcodeAndEquals = false
}
sourceSets.main.java.srcDirs += "build/generated/js2p"
...
...
However, I don't think that the jsonSchema2Pojo is even relevant since gradle complains about the line id "org.jsonschema2pojo" version "${JSONSCHEMA2POJO_VERSION}"
On a side note, we're using the plugin in a multi-module gradle build. I.E we have a structure similar to:
Out of curiosity I tried version 1.3.0 since we went from 1.2.2 directly to 1.3.1 and there I see a different issue:
* What went wrong:
Execution failed for task ':rest-service:generateJsonSchema2Pojo'.
> class org.apache.commons.lang3.Strings$CsStrings tried to access method 'int org.apache.commons.lang3.CharSequenceUtils.indexOf(java.lang.CharSequence, java.lang.CharSequence, int)' (org.apache.commons.lang3.Strings$CsStrings is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @63d617f3; org.apache.commons.lang3.CharSequenceUtils is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @664218d2)
BTW with version 1.3.1 I can't even do a ./gradlew tasks without getting
Could not apply requested plugin [id: 'org.jsonschema2pojo', version: '1.3.1'] 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.
I've looked at @NilsDammenhayn repo branch and indeed it fails.
Failure though is due to jsonschema2pojo-gradle-plugin-1.3.1.jar being a tiny bit different:
Indeed, the root-cause is similar on my side. I'm using JFrog as a proxy for all artifact resolution, and I had to re-setup the gradlePluginPortal repo. That proxy has been in place for some years and always worked. Can't explain why it broke today for exactly this dependency...
Can't explain why it broke today for exactly this dependency
I'll speculate that this is most probably due to JFrog proxying artifact resolution from maven central (maybe even having gradle plugin portal as a failover).
As version 1.3.1 itself is present in maven central but artifact is missing a org.jsonschema2pojo.properties file - build fails.
Thanks for the workaround @unkish !
One more hint for others: the order of the repositories is important, gradlePluginPortal has to be checked first here.
Thanks for the workaround @unkish ! One more hint for others: the order of the repositories is important, gradlePluginPortal has to be checked first here.
Just a minute note: it seems to be in case when buildscriptrepositories is used.
I've tried your example with following model/build.gradle.kts:
changed the title [-]Version 1.3.1 does not provide a plugin with id 'org.jsonschema2pojo'[/-][+]Could not apply requested plugin error when using version 1.3.1 of Gradle plugin 'org.jsonschema2pojo'[/+]on Feb 2, 2026
I remember intimately now having to solve this in the past, because depending on the order of repositories some people will get the jar from the maven central and some from the Gradle plugin portal. Publishing to maven central happens differently but we need to make sure that the same metadata is included in both cases.
This metadata is generated during Gradle publishing, but I had forgotten that the reason this same metadata is included as a file in the project is that it's needed within the jar that goes to Maven Central. Newer versions of Gradle complain about a duplicate file, so I just need to solve this another way.
* What went wrong:
Execution failed for task ':rest-service:generateJsonSchema2Pojo'.
> class org.apache.commons.lang3.Strings$CsStrings tried to access method 'int org.apache.commons.lang3.CharSequenceUtils.indexOf(java.lang.CharSequence, java.lang.CharSequence, int)' (org.apache.commons.lang3.Strings$CsStrings is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @63d617f3; org.apache.commons.lang3.CharSequenceUtils is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @664218d2)
If there's some other issue I'd rather try to fix it before releasing 1.3.2.
@joelittlejohn all good, that was a follow-up error due to another library still pulling in an old version of commons-lang3 and could easily be fixed. A quick look at where the classes were loaded gave me enough insights to fix the issue.
I reverted back to the Maven style repo definition in Artifactory and tried 1.3.2 which resolves fine. I'll still keep the new Gradle style definition for now to be safe for the future. Thanks for your fast support.
Activity
digsim commentedon Feb 2, 2026
Same issue here with gradle 9.3.1 (and Java 21)
joelittlejohn commentedon Feb 2, 2026
Thanks for raising this! I had to resolve a duplicate resource problem and it appeared that a file was not needed, but clearly it was. I'm surprised that our 'example' project did not pick this up.
unkish commentedon Feb 2, 2026
Would it be possible to provide a minimal working example of failing build ?
joelittlejohn commentedon Feb 2, 2026
I actually can't replicate this issue @NilsDammenhayn @digsim. I've tried with 1.30 and 1.3.1, using both Gradle 8.9 and Gradle 9.3.1. Could you show us how you are using the plugin in your build.gradle? Or provide a minimal example as @unkish says?
digsim commentedon Feb 2, 2026
I'll try to provide a minimal example this evening after work. We use the plugin like
However, I don't think that the
jsonSchema2Pojois even relevant since gradle complains about the lineid "org.jsonschema2pojo" version "${JSONSCHEMA2POJO_VERSION}"On a side note, we're using the plugin in a multi-module gradle build. I.E we have a structure similar to:
The snippet above comes from the
build.gradlefile located in therest-servicesubproject folder.NilsDammenhayn commentedon Feb 2, 2026
@joelittlejohn I'll try to provide an example tonight!
digsim commentedon Feb 2, 2026
Out of curiosity I tried version 1.3.0 since we went from 1.2.2 directly to 1.3.1 and there I see a different issue:
BTW with version 1.3.1 I can't even do a
./gradlew taskswithout gettingNilsDammenhayn commentedon Feb 2, 2026
I've created this branch. 1.3.0 works fine, changing that version in gradle/libs.versions.toml to 1.3.1 produces the error
unkish commentedon Feb 2, 2026
I've looked at @NilsDammenhayn repo branch and indeed it fails.
Failure though is due to
jsonschema2pojo-gradle-plugin-1.3.1.jarbeing a tiny bit different:vs
The one on maven central does not have
META-INF/gradle-plugins/org.jsonschema2pojo.propertiesA way to make sure that gradle loads plugins from gradle plugin portal is to change
model/build.gradle.ktsfrom:buildscript { repositories { mavenCentral() } }to
digsim commentedon Feb 2, 2026
Indeed, the root-cause is similar on my side. I'm using JFrog as a proxy for all artifact resolution, and I had to re-setup the gradlePluginPortal repo. That proxy has been in place for some years and always worked. Can't explain why it broke today for exactly this dependency...
unkish commentedon Feb 2, 2026
I'll speculate that this is most probably due to JFrog proxying artifact resolution from maven central (maybe even having gradle plugin portal as a failover).
As version
1.3.1itself is present in maven central but artifact is missing aorg.jsonschema2pojo.propertiesfile - build fails.NilsDammenhayn commentedon Feb 2, 2026
Thanks for the workaround @unkish !
One more hint for others: the order of the repositories is important, gradlePluginPortal has to be checked first here.
unkish commentedon Feb 2, 2026
Just a minute note: it seems to be in case when
buildscriptrepositoriesis used.I've tried your example with following
model/build.gradle.kts:Note how there is no
buildscript { repositories { mavenCentral() } }in the beginning of the script and jsonSchema2Pojo plugin got downloaded from gradle plugin portal.
P.S. Thank you for providing a reproducer.
[-]Version 1.3.1 does not provide a plugin with id 'org.jsonschema2pojo'[/-][+]Could not apply requested plugin error when using version 1.3.1 of Gradle plugin 'org.jsonschema2pojo'[/+]joelittlejohn commentedon Feb 2, 2026
I remember intimately now having to solve this in the past, because depending on the order of repositories some people will get the jar from the maven central and some from the Gradle plugin portal. Publishing to maven central happens differently but we need to make sure that the same metadata is included in both cases.
This metadata is generated during Gradle publishing, but I had forgotten that the reason this same metadata is included as a file in the project is that it's needed within the jar that goes to Maven Central. Newer versions of Gradle complain about a duplicate file, so I just need to solve this another way.
joelittlejohn commentedon Feb 2, 2026
@digsim Did you get to the bottom of this one:
If there's some other issue I'd rather try to fix it before releasing 1.3.2.
digsim commentedon Feb 2, 2026
@joelittlejohn all good, that was a follow-up error due to another library still pulling in an old version of
commons-lang3and could easily be fixed. A quick look at where the classes were loaded gave me enough insights to fix the issue.Restore Gradle plugin metadata so that it's included in Maven Central…
joelittlejohn commentedon Feb 2, 2026
This should now be fixed, give 1.3.2 a try 👍
digsim commentedon Feb 3, 2026
I reverted back to the Maven style repo definition in Artifactory and tried 1.3.2 which resolves fine. I'll still keep the new Gradle style definition for now to be safe for the future. Thanks for your fast support.
NilsDammenhayn commentedon Feb 3, 2026
Works here too, thank you very much! ❤️