Skip to content

docs(xsd-java): run XsdValidate.java directly via JDK source launcher (no Maven needed) - #22

Merged
karlkauc merged 1 commit into
mainfrom
docs/xsd-java-source-launcher
Aug 28, 2026
Merged

karlkauc merged 1 commit into
mainfrom
docs/xsd-java-source-launcher

Conversation

@karlkauc

Copy link
Copy Markdown
Contributor

Summary

  • XSD_Validation/java/XsdValidate.java has zero dependencies beyond the JDK, so Maven is not required to run it. JDK 11+ compiles and runs the single source file directly:
    java XSD_Validation/java/XsdValidate.java <schema> <xml-file>
    
    This is now the documented primary invocation (class header, module pom.xml comment, XSD_Validation/README.md, root README.md); the ./mvnw … exec:java path stays as the alternative CI uses.
  • pom.xml comment was stale (still described env-var/cache/4.2.9 version resolution removed in refactor(xsd): validators take <schema> <xml-file>, drop version-based resolution #21) — fixed.
  • Robustness: a missing/unreadable/malformed schema now exits 2 with a one-line message instead of a stack trace + exit 1, matching the documented exit codes.

Verification (JDK 26, local)

call result
java …/XsdValidate.java $REL Mixed-Fund_Positions.xml VALID, exit 0
java …/XsdValidate.java $REL tests/fixtures/invalid/xsd-invalid_Positions.xml INVALID (line 58), exit 1
java …/XsdValidate.java /nonexistent.xsd … cannot load schema …, exit 2
./mvnw -q -pl XSD_Validation/java compile exec:java … VALID, exit 0

CI is unchanged (still exercises the Maven path).

🤖 Generated with Claude Code

https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ

…Maven needed

XsdValidate.java has no dependency beyond the JDK (javax.xml.validation +
java.net.http), so JDK 11+ can compile and run it directly (JEP 330):
  java XSD_Validation/java/XsdValidate.java <schema> <xml-file>
Document this as the primary invocation in the class header, the module
pom.xml comment, XSD_Validation/README.md and the root README; keep the
Maven aggregator path as the alternative that CI uses.

Also fix the pom.xml comment, which still described the pre-#21 version
resolution (env var / cache / "4.2.9" arg).

Robustness: a missing, unreadable or malformed schema now exits 2 with a
one-line message instead of stack-tracing out with exit 1, matching the
documented exit codes (0 valid / 1 invalid / 2 usage or setup error).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YXZWhwE5EbHSybt55K6oUZ
@karlkauc
karlkauc merged commit 91bdb76 into main Aug 28, 2026
4 checks passed
@karlkauc
karlkauc deleted the docs/xsd-java-source-launcher branch August 28, 2026 15:46
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