Maven archetype that generates a complete SWIM data model project with JAXB bindings, XSD validation, and thread-safe unmarshalling. The generated project follows the same structure as swim-aixm-model and swim-fixm-model-ed254.
- JDK 21
- Maven 3.9+
- The
swim-developerparent POM installed in the local Maven repository
cd swim-model-archetype
mvn clean installmvn archetype:generate \
-DarchetypeGroupId=com.github.swim-developer \
-DarchetypeArtifactId=swim-model-archetype \
-DarchetypeVersion=1.0.0-SNAPSHOT \
-DgroupId=com.github.swim-developer \
-DartifactId=swim-fixm-ffice-model \
-Dversion=1.0.0-SNAPSHOT \
-Dpackage=aero.fixm.ffice \
-DmodelName=ffice \
-DmodelDisplayName="FF-ICE" \
-DmodelPrefix=Ffice \
-DrootSchema=FficeMessage.xsd \
-DdataStandard=FIXM \
-DinteractiveMode=false| Parameter | Description | Example |
|---|---|---|
modelName |
Lowercase identifier used in binding filenames and test resource directories | ffice |
modelDisplayName |
Human-readable name for README and project description | FF-ICE |
modelPrefix |
PascalCase prefix for generated class names (UnmarshallerPool, XsdValidator) | Ffice |
rootSchema |
Entry point XSD filename for JAXB code generation | FficeMessage.xsd |
dataStandard |
Data exchange standard family (used in project name and description) | FIXM |
Standard Maven parameters (groupId, artifactId, version, package) are also supported.
After generating the project, make the Maven wrapper executable:
cd swim-fixm-ffice-model
chmod +x mvnwRun once before building to pull the project and install its only dependency (swim-developer-root) into the local Maven repository:
make syncOr run each step individually:
make pull # git pull --ff-only on this project
make pull-deps # clone or pull swim-developer-root from GitHub
make install-deps # install swim-developer-root into local Maven repoCompile the generated project to confirm everything is wired correctly:
./mvnw compileThe archetype produces 3 Java classes + configuration files, organized for JAXB code generation:
| Class | Purpose |
|---|---|
{Prefix}UnmarshallerPool |
Thread-safe unmarshaller pool with XSD validation and XXE prevention |
{Prefix}XsdValidator |
Lightweight wrapper for standalone XSD validation |
| Class | Purpose |
|---|---|
{Prefix}UnmarshallerPoolTest |
Unit tests for null/empty/invalid XML handling |
| File | Purpose |
|---|---|
pom.xml |
Parent POM, JAXB dependencies, generate-xjc profile |
src/main/resources/bindings/{modelName}.xjb |
JAXB namespace-to-package mappings (TODO) |
src/main/resources/schemas/ |
Empty directory for XSD schemas |
Makefile |
Build targets: sync, pull, pull-deps, install-deps, install, test, sonar, security-deps |
README.md |
Project documentation |
- Copy your XSD schemas into
src/main/resources/schemas/ - Update
src/main/resources/bindings/{modelName}.xjbwith namespace-to-package mappings - Update the
clean-generated-sourcessection inpom.xmlwith the generated package directories - Update
{Prefix}UnmarshallerPoolconstructor with the generatedObjectFactoryclasses - Run
./mvnw process-sources -Pgenerate-xjcto generate JAXB classes - Add test XML samples to
src/test/resources/
Use the existing swim-fixm-model-ed254 and swim-aixm-model as reference implementations. Their binding files, schema organization, and validation classes demonstrate the patterns expected by each TODO.
- Java: 21
- Jakarta XML Binding API: 4.0.5
- GlassFish JAXB Runtime: 4.0.7
- JAXB Maven Plugin: 4.0.12