Skip to content

Do Not Use forceRegenerate

Laurent Schoelens edited this page Aug 25, 2023 · 2 revisions

Do not use <forceRegenerate>true</forceRegenerate> and switch to the 0.12.1 or later version of the plugin.

Historically, the plugin supports the <forceRegenerate>true</forceRegenerate> configuration setting.

When set to true, this setting will force the plugin to regenerate the sources - regardless of whether something was changed or not. In older version of the plugin this was useful if you've processed non-file resources like external URLs or resources from Maven artifacts - and wanted to force regenration when running mvn install without mvn clean.

The disadvantage is, however, that this forces XJC execution no matter what. This is especially problematic when using the plugin IDEs (for example in Eclipse via m2e). Incremental builds are important for IDE integration and forceRegenerate=true effectively disables them.

In 0.12.1 the up-to-date check for resources was extended to non-file-resources like Maven artifacts and files. The plugin will now do its best to check the last modification timestamp. Therefore mvn install should work even if you're using this type of resources. Basically there's no longer need for <forceRegenerate>true</forceRegenerate>.

To sum up, the use of <forceRegenerate>true</forceRegenerate> is strongly discouraged. Consider removing this setting from your configuration (will default to false). If you need a full rebuild, do mvn clean instead.

The setting will be kept for backwards compatibility, but the plugin will display a warning if it is used.

Clone this wiki locally