-
Notifications
You must be signed in to change notification settings - Fork 99
Up To Date Checks
To avoid unnecessary regeneration (which may be very time-consuming), the plugin checks, if the generated code is still up-to-date (copared to the source schemas and other files). If everything is up-to-date then code generation will be skipped. However, you can use the forceRegenerate=true
to force regeneration every time. This is explicitly not recommended.
The up-to-date check algorithm is as follows:
- Gather the URIs of the "source" resources:
- The
pom.xml
file of the project. - The resolved URIs of the catalog files and resources.
- The resolved URIs of the schema files and resources.
- The resolved URIs of the binding files and resources.
- URIs of the additionally configured
otherDepends
/otherDependsIncludes
/otherDependsExcludes
files.
- The
- Gather the URIs of the "target" resources:
- Scan the
generateDirectory
for files which match theproduces
pattern, and collect their URIs.
- Scan the
- Find out the latest timestamp of the "source" resources (timestamp of the resource update) and earliest timestamp of the "target" resources (timestamp of the generation).
- If timestamp of the update is later than the timestamp of the generation, or if some of the timestamps is unknown, regenerate.
- Otherwise - that is, if both update and generation timestamps are known and update was not later that generation, do not regenerate.
The regeneration is controlled by the following configuration elements:
-
forceRegenerate
- Iftrue
, no up-to-date check is performed and the XJC always re-generates the sources. Otherwise schemas will only be recompiled if anything has changed (this is the default behavior). SettingforceRegenerate
totrue
is not recommended. - Configured catalogs, schemas and bindings.
-
otherDepends
- other files to check for updates. Deprecated, useotherDependsIncludes
/otherDependsExcludes
instead. -
otherDependsIncludes
/otherDependsExcludes
- patterns of other files to check for updates. -
produces
- patterns of of files produced by this plugin. Default value is**/*.*, **/*.java, **/bgm.ser, **/jaxb.properties
.
To perform the up-to-date-check, the plugin has to find out the last modification timestamp for each of the source URIs. These source URIs may be files, but also other URIs. The plugin supports the following URI schemes:
-
file
(a normal file) - last modification of the target file. -
jar
(a resource inside a JAR file) - last modification of the JAR file. It is assumed that if the JAR file was changed then the resource inside it was changed as well. -
http
orhttps
(Web resources) - last modification is taked from theLast-Modified
HTTP header. However, this is not reliable. Compiling schemas directly from Web resources is strongly discouraged anyway.
If the last modification timestamp could not be found out for some reason (for instance, the Web server does not return the header), it is assumed to be unknown and will consequently force regenration.
You may note that the maven
scheme used in Maven artifact resources is not listed. This is because all the URIs are resolved prior to the check. So the Maven artifact resource URI will either be resolved into a jar
URI or a file
URI, both of which are supported.
So this up-to-date check also works with Maven artifact resources. If you use a schema from the Maven artifact then the plugin will check that artifact/resource for actuality.
This up-to-date-check only works for resources directly configured in the plugin condiguration. If your schema a.xsd
import some other schema b.xsd
and that schema is not configured in the plugin configuration, it will not be considered during the up-to-date check. You may use otherDependsIncludes
and otherDependsExcludes
to configure additional resources to check.
- Home
- Migration guide
-
JAXB Maven Plugin
- Quick Start
-
User Guide
- Basic Usage
- Specifying What To Compile
- Referencing Resources in Maven Artifacts
- Using Catalogs
- Using Episodes
- Modular Schema Compilation
- Controlling the Output
- Using JAXB Plugins
- Using a Specific JAXB Version
- Configuring Extension, Validation and XML Security
- IDE Integration
- Miscellaneous
- Configuring Proxies
- Maven Documentation
- Configuration Cheat Sheet
- Common Pitfalls and Problems
-
JAXB2 Basics Plugins
- Using JAXB2 Basics Plugins
- JSR-305 Support
-
JAXB2 Basics Plugins List
- SimpleEquals Plugin
- SimpleHashCode Plugin
- Equals Plugin
- HashCode Plugin
- ToString Plugin
- Copyable Plugin
- Mergeable Plugin
- Inheritance Plugin
- AutoInheritance Plugin
- Wildcard Plugin
- Setters Plugin
- Simplify Plugin
- EnumValue Plugin
- JAXBIndex Plugin
- FixJAXB1058 Plugin
- Commons Lang Plugin
- Default Value Plugin
- Fluent API Plugin
- Namespace Prefix Plugin
- Value Constructor Plugin
- Boolean Getter Plugin
- CamelCase Plugin
- XML ElementWrapper Plugin
- Parent Pointer Plugin
- Property Listener Injector Plugin
- Annox
- JAXB Annotate Plugin
-
HyperJAXB3
- Build System Support
- Customization Guide
- Databases
- Development guide
- Extension guide
- FAQ
- IDE Support
- Java Persistence
- JAXB
- JDK Support
- Project Templates
-
Reference
- Adding vendor-specific annotations
- Features
- Integrating Hyperjaxb3 in builds
- Introduction
- Making schema-derived classes ready for JPA
- Adding required properties
- Applying workarounds for JAXB vs. JPA conflicts
- Enforcing top-level classes
- Generating equals and hashCode methods
- Generating ORM metadata
- Generating persistence unit descriptor
- JPA 2 Support
- Making classes serializable
- Testing generated mappings
- Reference - single page
- Related Projects
- Sample projects
- Solutions
- Target Scenarios
- Test Projects
- Tutorials
- Best Practices
- FAQ
- Sample Projects
- Support
- License
- Distribution