jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

Unable to generate sources for multiple version of java

Open sjmittal opened this issue 3 years ago • 1 comments

I am using the jsonschema2pojo-maven-plugin to generate java sources via maven. I have java version 11 installed on my PC but I need to generate the sources for both java8 and java11 versions. I have tried configuring the targetVersion attribute in the plugin but it still seems to be generating the source for java 11. Basically it is picking up the java version of the installed JRE and not the targetVersion property.

So as next step when I try to compile the sources as java8 it fails. The reason is because then import statements are generated as import javax.annotation.processing.Generated; and not import javax.annotation.Generated;

Any idea if this is an issue or how this can be worked around.

sjmittal avatar May 03 '21 03:05 sjmittal

I think we can fix this, but I'm interested to know if you are able to try adding this dependency to your project:

https://search.maven.org/artifact/org.jsonschema2pojo/jsonschema2pojo-jdk-annotation/0.0.1/jar

In theory it includes only the annotation that you need, and is intended to be used when javax.annotation.processing.Generated is not available.

joelittlejohn avatar May 03 '21 10:05 joelittlejohn

Closed by #1482.

joelittlejohn avatar Feb 16 '23 09:02 joelittlejohn