You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jdt2jar/README.md
+29-17Lines changed: 29 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# jdt2jar
2
2
3
-
`jdt2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 24+ runtime dependency.
3
+
`jdt2jar` compiles a JTD schema into a standalone validator JAR at build time. The generated JAR runs on JDK 21+ with no JDK 25+ runtime dependency.
4
4
5
5
## Use Case
6
6
7
7
This tool bridges the gap between the interpreter and codegen paths:
8
8
9
9
-**Interpreter** ([`json-java21-jtd`](../json-java21-jtd/README.md)): ideal for infrequent config parsing — simple, no build step, runs on JDK 21+.
10
-
-**Codegen** ([`json-java21-jtd-codegen`](../json-java21-jtd-codegen/README.md)): ideal for repeated hot-path validation — ~9x faster, but requires JDK 24+ at runtime.
11
-
-**jdt2jar**: pre-compiles schemas into validator JARs at build time (using JDK 24+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 24+ runtime.
10
+
-**Codegen** ([`json-java21-jtd-codegen`](../json-java21-jtd-codegen/README.md)): ideal for repeated hot-path validation — ~9x faster, but requires JDK 25+ at runtime.
11
+
-**jdt2jar**: pre-compiles schemas into validator JARs at build time (using JDK 25+), then deploys them to any JDK 21+ runtime. Best for CI/CD pipelines, distroless containers, or environments where you want JIT-optimised validators without shipping a JDK 25+ runtime.
12
12
13
13
> **Future note**: `java.util.json` has entered the JDK incubator (`jdk.incubator.json`). Once the API stabilises in the JDK itself, generated bytecode validators can depend directly on future JDK classes rather than this backport, making them even more efficient with zero library overhead.
14
14
@@ -39,35 +39,47 @@ A minimal distroless container image is available for offline schema compilation
Requires Docker and JDK 24+ (for the build stage). Build from the repository root:
47
+
Requires Docker and JDK 25+ (for the build stage). Build from the repository root:
48
48
49
49
```bash
50
50
docker build -t jdt2jar -f jdt2jar/Dockerfile .
51
51
```
52
52
53
53
### Usage
54
54
55
+
The container's working directory is `/work`. Mount your local directory there, or use `docker cp` for environments where volume mounts are restricted (e.g., Colima on macOS).
56
+
57
+
#### Option 1: Volume mount (Linux, Docker Desktop with file sharing enabled)
58
+
55
59
```bash
56
-
#Show help
57
-
docker run --rm ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest --help
60
+
#bash / zsh
61
+
docker run --rm -v "$(pwd):/work"ghcr.io/simbo1905/java.util.json.java21/jdt2jar:latest schema.jtd.json --output schema-validator.jar --main
58
62
59
-
# Compile a schema to a validator JAR (using docker cp for file I/O)
0 commit comments