jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

Not able to use in gradle with correct dependencies. tried the sample gradle file but got error

Open Lionertic opened this issue 2 years ago • 2 comments

An exception occurred applying plugin request [id: 'org.jsonschema2pojo', version: '1.2.1']

Failed to apply plugin 'org.jsonschema2pojo'. generateJsonSchema: Java or Android plugin required

Lionertic avatar Jun 08 '23 09:06 Lionertic

Hi

Does the project have any of these:

  • apply plugin: 'com.android.application'
  • apply plugin: 'com.android.library'
  • apply plugin: 'java'

As per JsonSchemaPlugin.groovy exception is throw if none of the below evaluates to true: https://github.com/joelittlejohn/jsonschema2pojo/blob/98c85ce4d4b9333bafae2c18eca5637ea6a7c5da/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaPlugin.groovy#L33 https://github.com/joelittlejohn/jsonschema2pojo/blob/98c85ce4d4b9333bafae2c18eca5637ea6a7c5da/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/JsonSchemaPlugin.groovy#L35

unkish avatar Jun 08 '23 09:06 unkish

What Gradle version are you using?

From the README.md for the Gradle plugin:

For Gradle 7.3 and later, you can use the plugins DSL: ... For Gradle 7.2.x and older, there is a bug related to the application order of plugins so you must use legacy plugin application.

Could this be the issue? I think it manifests in this way.

joelittlejohn avatar Jun 08 '23 10:06 joelittlejohn