Multiple Gradle jsonSchema2Pojo configurations

459 views
Skip to first unread message

sodoff...@gmail.com

unread,
Jul 3, 2019, 4:03:59 AM7/3/19
to jsonschema2pojo-users
I have two different sets of JSON schemas that need different jsonSchema2Pojo configuration.  Could anyone help me with how to achieve this in Gradle?

I've seen https://groups.google.com/forum/#!searchin/jsonschema2pojo-users/gradle$20plugin$20task%7Csort:date/jsonschema2pojo-users/mJzs3j797QQ/wBEgqZBS7EQJ but this isn't working for me and unfortunately I'm not very familiar with Gradle so I'm struggling to figure out how to create my second task correctly.

task myJsonSchema2Pojo << {
    generateJsonSchema2Pojo(source:files("src/main/resources/jsonschema"), targetPackage:'uk.wibble', targetDirectory:file("${generatedDir}")).execute()
}

When I run ./gradlew myJsonSchema2Pojo I see "Could not find method generateJsonSchema2Pojo() for arguments [{source=file collection, targetPackage=uk.wibble, targetDirectory=C:\myproject\src\main\generated}] on task ':myproject:myJsonSchema2Pojo' of type org.gradle.api.DefaultTask."

Any idea what I'm doing wrong?

Joe Littlejohn

unread,
Jul 3, 2019, 4:37:40 AM7/3/19
to jsonschema...@googlegroups.com
I'm not a Gradle user so I'm afraid I can't help you. It looks like this is more a question about Gradle syntax than about jsonschema2pojo though. I think StackOverflow might be a better place to ask this question.

--
You received this message because you are subscribed to the Google Groups "jsonschema2pojo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jsonschema2pojo-...@googlegroups.com.
Visit this group at https://groups.google.com/group/jsonschema2pojo-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/jsonschema2pojo-users/3b48b39c-3a56-42fb-a4d3-941d71545501%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michal Polák

unread,
Jun 5, 2024, 10:53:24 AM6/5/24
to jsonschema2pojo-users
I do believe the problem is at 46 row https://github.com/joelittlejohn/jsonschema2pojo/blob/master/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GenerateJsonSchemaJavaTask.groovy:

configuration = project.jsonSchema2Pojo

It should be possible to pass the configuration from outside.....
Reply all
Reply to author
Forward
0 new messages