0

I am working with jsonschema2pojo and now dealing with more complex java types within. I have come across an issue when it comes to regenerating a recently generated class.

Example, my definitions has the followed defined:

"definitions" : {
    "Test" : {
      "javaType" : "com.generated.model.Test",
      "properties" : {
        "name" : {
          "type" : "string"
        }
      },
      "type" : "object"
     }
}    

And is referenced in my schema as follows:

"anotherName" : {
      "$ref" : "#/definitions/Test",
      "type" : "object"
    }

This works great, the first time around, and generates an object for my schema and the complex type. As part of my set-up, I have a custom launcher/generator that deletes the java packages before it generates using jsonschema2pojo.

The second time I run, the complex type does not get generated. I assume it's due to the classpath still having a handle on the generated class, and jsonschema2pojo ignores the need to regenerate.

My question, is there anyway in this tool to get around this? Or a way in java to reload the classpath after I delete the java package?

The documentation for the project is under 'javaType' here: https://github.com/joelittlejohn/jsonschema2pojo/wiki/Reference

Thank you in advance.

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
lemoncolly
  • 13
  • 5

1 Answers1

0

If you have a compiled type on the classpath, then no new sources will be generated if you reference that type.

You need to clean the project (remove the compiled classes that were built from generated sources) each time you want a fresh build.

joelittlejohn
  • 11,665
  • 2
  • 41
  • 54