Skip to content

Phase 1: Java examples standalone & cross-platform via Maven - #14

Merged
karlkauc merged 1 commit into
mainfrom
feat/java-maven-standalone
May 16, 2026
Merged

karlkauc merged 1 commit into
mainfrom
feat/java-maven-standalone

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Why

Every Java example used to depend on bash: tools/fetch-tools.sh (jars into a gitignored .lib/) + raw javac + :-separated classpaths + run-*.sh wrappers. None of that runs on Windows and it required a prior tool step. This is Phase 1 of 4 of making all examples standalone & cross-platform (plan: per-language idiomatic build systems, no bash prerequisite).

What changed (Java only)

  • Root pom.xml aggregator + committed Maven Wrapper (mvnw/mvnw.cmd, only-script, Maven 3.9.9) — no preinstalled Maven needed.
  • One module per example, <sourceDirectory> left at the existing flat dirs so the teaching sources don't move. Dependency versions pinned to exactly what fetch-tools.sh used → behaviour unchanged. SchXslt (bundles its own Saxon) kept in its own module, separate from the Saxon-HE XSLT/XQuery modules, preserving the documented org.xmlresolver conflict fix.
  • In-language schema resolution in XsdValidate.java: $FUNDSXML_SCHEMA_DIR (offline / corporate-network escape hatch) → .schema-cache/ → download from the official GitHub release (follows the 302, fetches the xmldsig-core-schema.xsd sibling when imported). Official release stays the source of truth; no committed catalog.
  • GenerateTestKey.java replaces the openssl generate-test-key.sh using the JDK's own keytool → works on Windows.
  • Deleted: tools/fetch-tools.sh, run-schematron.sh, run-transform.sh, run-xquery.sh, generate-test-key.sh.
  • CI: all Java steps now drive ./mvnw; blockSystemExit=false so the example's exit code propagates and the negative-fixture assertions still hold. fetch-schema.sh kept (xmllint/Python/.NET still need the cache until their phases).
  • Docs swept: per-component READMEs, CONTRIBUTING.md, issue template, .gitignore; not-yet-migrated Python/.NET reference comments no longer point at deleted scripts.

Verification

Run locally from the repo root via ./mvnw (all green): XSD validation (env-var / cache-hit / cold download + negative fixture exits 1), Schematron (positive 0 errors / negative exits 1), XSLT (custom DQ, factsheet HTML+FO, CSV), XQuery (top-holdings n=5 → 5 holdings), XML signature (keygen → sign → verify OK → tamper → INVALID), DB round-trip (import→export, xml_equiv equal, XSD-valid), large-file streaming, native data binding. Clean-state ./mvnw -q -B clean compile succeeds for the whole reactor.

Phases 2 (Python), 3 (.NET), 4 (CLI pair + final bash purge + windows-latest CI) follow as separate PRs.

🤖 Generated with Claude Code

Replace the bash-only Java toolchain (tools/fetch-tools.sh + raw javac +
.lib/ ":"-classpaths + run-*.sh wrappers) with a standard Maven build so
every Java example runs on Windows too, with no prior tool step.

- Root pom.xml aggregator + committed Maven Wrapper (mvnw/mvnw.cmd,
  only-script, Maven 3.9.9) so no preinstalled Maven is needed.
- One module per example; <sourceDirectory> left at the existing flat
  example dirs so the teaching sources do not move. Dependency versions
  pinned to exactly what fetch-tools.sh used (behaviour unchanged). The
  SchXslt (bundled-Saxon) module is kept separate from the Saxon-HE
  XSLT/XQuery modules to preserve the org.xmlresolver-conflict fix.
- XsdValidate resolves the official XSD itself: $FUNDSXML_SCHEMA_DIR
  (offline/corporate escape hatch) -> .schema-cache/ -> download from the
  GitHub release (follows the 302, fetches the xmldsig sibling when
  imported). Source of truth stays the official release; no committed
  catalog.
- New XML_Signature/java/GenerateTestKey.java generates the throwaway
  signing key with the JDK's own keytool (no openssl) -> works on Windows.
- Deleted: tools/fetch-tools.sh, run-schematron.sh, run-transform.sh,
  run-xquery.sh, generate-test-key.sh.
- ci.yml: all Java steps now drive ./mvnw; exit codes propagate
  (blockSystemExit=false) so negative-fixture asserts still hold.
- Docs swept (READMEs / CONTRIBUTING / issue template / .gitignore) to the
  Maven Wrapper commands; not-yet-migrated Python/.NET reference comments
  no longer point at deleted scripts.

Verified locally via ./mvnw: XSD (env/cache/download + negative fixture),
Schematron (±), XSLT, XQuery, sign/verify/tamper, DB round-trip +
xml_equiv + XSD-valid, large-file streaming, data binding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@karlkauc
karlkauc merged commit 1269914 into main May 16, 2026
2 checks passed
@karlkauc
karlkauc deleted the feat/java-maven-standalone branch May 16, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant