mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
106 stars 77 forks source link

Avoid Unnecessary regeneration #87

Closed debraj-manna closed 6 years ago

debraj-manna commented 7 years ago

Is it possible to avoid unnecessary regeneration in jaxb2-maven-plugin? Basically I want to generate the sources only when underlying schema has changed.

It seems maven-jaxb2-plugin has an option force-regenerate. Do similar option exist in jaxb2-maven-plugin? If not can someone suggest me some way to achieve this?

lennartj commented 6 years ago

The JMP has a "staleFile", used to tell the plugin if regeneration is needed. That file is located in the target directory, and the parameter is defined as follows:

    /**
     * <p>The directory where the staleFile is found.
     * The staleFile assists in determining if re-generation of JAXB build products is required.</p>
     * <p>While it is permitted to re-define the staleFileDirectory, it is recommended to keep it
     * below the <code>${project.build.directory}</code>, to ensure that JAXB code or XSD re-generation
     * occurs after cleaning the project.</p>
     *
     * @since 2.0
     */
    @Parameter(defaultValue = "${project.build.directory}/jaxb2", readonly = true, required = true)
    protected File staleFileDirectory;