Skip to content

Add 'removeOldOutput' option to clear all previously generated sources #92

@joelittlejohn

Description

@joelittlejohn

Original author: [email protected] (March 05, 2013 22:18:53)

What steps will reproduce the problem?

  1. Create a schema, e.g. a type with some enum values
  2. Generate POJO
  3. Modify schema, eg. add new value to enum
  4. Re-Generate POJO

What is the expected output?
The Java source now contains the new enum value.

What do you see instead?
The Java source, generated in step 2, remains unchanged.

What version of the tool are you using? On what Java version? (On what
version of Maven/Ant if applicable?)
Use maven and latest build 0.3.5

If I remove the Java files before step 3, then the Java file is properly generated with the new enum value.

Would it be possible to include a "clean" option to the generate target so that if set to true, all files already present in the generation folder specified would be deleted before starting the generation process (equivalent of deleting manually the already generated files). This is especially important, since you typically do not check-in generate sources, and as such, you expect no sources to be already generated (note that you may have .class reused if found in your class-path, e.g. a jar). Cleaning up source folder before the source generation process therefore makes sense.

I don't know what causes the class not to be refreshed when schema change. Is there any logic that says if the Java (not class) file is present do not regenerate? If the algo (which I believe is the one used) is "if class file exists, do not generate/overwrite source", then I would need to somehow clean not the Java source files but actually the Java (generated) class files from the folder the (maven) project use to store compiled classes, following Java source generation.

Let me know if the description is unclear. I tried my best.

Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=92

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions