Overview
Create the copilot-native/ Maven module (com.github:copilot-sdk-java-runtime) that downloads the runtime.node binary for linux-x64 only via npm pack and packages it as a linux-x64 classifier JAR with SHA-512 integrity verification.
This is task 4.7 of 9 in the implementation plan. Tasks are assigned, completed, and merged serially in this listed order. Tasks 4.1–4.6 are complete on the base branch before this task begins.
Branch: edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02 on upstream
Plan and supporting resources
On the edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02 branch, the directory 1917-java-embed-rust-cli-runtime-remove-before-merge contains the plan (1917-embed-cli-runtime-ignorance-reduction-plan.md) and supporting resources (spikes, prototypes, diagrams).
Read the entire plan before working.
Relevant plan sections to carefully re-read
- Section 3.1 — Maven module structure — Resolution: Option B — multi-module reactor.
copilot-native module uses multiple maven-jar-plugin executions per platform. Plus a placeholder primary JAR. The copilot-native-all uber-JAR module is deferred.
- Section 3.2 — How do native binaries enter the build — Resolution: Option C variant —
npm pack per-platform via exec-maven-plugin. SHA-512 integrity verification against nodejs/package-lock.json. Temporary invariant: linux-x64 only. Node.js is required for this module but NOT for the main SDK.
- Section 4.7 — Native binary download and classifier JAR module (the primary task description).
- Hard scope invariant (Phase 4 preamble): All native implementation work is limited to Ubuntu 24.04 on linux-x64 only. Other platforms are out of scope.
Resolved decisions that constrain this task
- Module GAV:
com.github:copilot-sdk-java-runtime
- Version alignment:
${project.version} matches the npm @github/copilot-<platform> package version. No separate version property needed.
- Download mechanism:
npm pack @github/copilot-linux-x64@${project.version} in generate-resources phase via exec-maven-plugin.
- Staging path:
target/native-staging/linux-x64/native/linux-x64/runtime.node (after tar extraction).
- Integrity verification: Read
integrity field (SHA-512) from ${copilot.sdk.root}/nodejs/package-lock.json for @github/copilot-linux-x64. Verify downloaded .tgz against it.
- Placeholder primary JAR: Contains only
native/lib/copilot-runtime.properties with placeholder=true. Satisfies Maven Central validation.
- Classifier JAR: One
maven-jar-plugin execution with <classifier>linux-x64</classifier>, packaging from target/native-staging/linux-x64/.
- Resource path convention:
native/<classifier>/runtime.node and native/<classifier>/platform.properties (containing classifier=linux-x64 and version=${project.version}).
- Node.js dependency: Required for this module. Already required for Java E2E tests (replay proxy), so no new build dependency introduced.
- Module can be skipped: Developers working only on SDK Java code can run
mvn -pl sdk to skip this module entirely.
Deliverables
Files to create
-
java/copilot-native/pom.xml — Module POM with:
- Parent:
copilot-sdk-java-parent
- GAV:
com.github:copilot-sdk-java-runtime
exec-maven-plugin in generate-resources phase: runs npm pack @github/copilot-linux-x64@${project.version}
tar extraction step to target/native-staging/linux-x64/native/linux-x64/runtime.node
- SHA-512 integrity verification step reading from
${copilot.sdk.root}/nodejs/package-lock.json
- Default
maven-jar-plugin execution producing placeholder primary JAR
- Additional
maven-jar-plugin execution with <classifier>linux-x64</classifier>, packaging from target/native-staging/linux-x64/
- Optional:
build-helper-maven-plugin wiring prepared for future Gradle Module Metadata expansion
-
java/copilot-native/src/main/resources/native/lib/copilot-runtime.properties — Placeholder properties file: placeholder=true, version=${project.version}
-
Platform properties for the classifier JAR — The build step must produce native/linux-x64/platform.properties containing:
classifier=linux-x64
version=${project.version}
Files to modify
java/pom.xml (parent POM) — Uncomment/add copilot-native in <modules>. Ensure copilot.sdk.root property is defined so the native module can reference nodejs/package-lock.json.
Gating tests and criteria
- Classifier JAR produced:
mvn package -pl copilot-native produces the linux-x64 classifier JAR containing native/linux-x64/runtime.node.
- Placeholder JAR produced: The primary JAR contains
native/lib/copilot-runtime.properties and NO native binaries.
- SHA-512 verification passes: The integrity hash from
nodejs/package-lock.json matches the downloaded .tgz.
- Reactor build:
mvn clean verify from java/ runs the full reactor (including this module).
- SDK-only build:
mvn -pl sdk clean verify still works (skipping the native module).
- All prior tests pass:
mvn verify from java/ passes.
Out of scope
- Building classifier JARs for any platform other than
linux-x64 (deferred to later phase).
- Monolithic uber-JAR assembly (
copilot-native-all module) — deferred.
- Gradle Module Metadata (
.module) file — deferred (wiring can be prepared but not activated).
- Publishing to Maven Central — separate workflow concern.
Overview
Create the
copilot-native/Maven module (com.github:copilot-sdk-java-runtime) that downloads theruntime.nodebinary forlinux-x64only vianpm packand packages it as alinux-x64classifier JAR with SHA-512 integrity verification.This is task 4.7 of 9 in the implementation plan. Tasks are assigned, completed, and merged serially in this listed order. Tasks 4.1–4.6 are complete on the base branch before this task begins.
Branch:
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02onupstreamPlan and supporting resources
On the
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02branch, the directory1917-java-embed-rust-cli-runtime-remove-before-mergecontains the plan (1917-embed-cli-runtime-ignorance-reduction-plan.md) and supporting resources (spikes, prototypes, diagrams).Read the entire plan before working.
Relevant plan sections to carefully re-read
copilot-nativemodule uses multiplemaven-jar-pluginexecutions per platform. Plus a placeholder primary JAR. Thecopilot-native-alluber-JAR module is deferred.npm packper-platform viaexec-maven-plugin. SHA-512 integrity verification againstnodejs/package-lock.json. Temporary invariant:linux-x64only. Node.js is required for this module but NOT for the main SDK.Resolved decisions that constrain this task
com.github:copilot-sdk-java-runtime${project.version}matches the npm@github/copilot-<platform>package version. No separate version property needed.npm pack @github/copilot-linux-x64@${project.version}ingenerate-resourcesphase viaexec-maven-plugin.target/native-staging/linux-x64/native/linux-x64/runtime.node(aftertarextraction).integrityfield (SHA-512) from${copilot.sdk.root}/nodejs/package-lock.jsonfor@github/copilot-linux-x64. Verify downloaded.tgzagainst it.native/lib/copilot-runtime.propertieswithplaceholder=true. Satisfies Maven Central validation.maven-jar-pluginexecution with<classifier>linux-x64</classifier>, packaging fromtarget/native-staging/linux-x64/.native/<classifier>/runtime.nodeandnative/<classifier>/platform.properties(containingclassifier=linux-x64andversion=${project.version}).mvn -pl sdkto skip this module entirely.Deliverables
Files to create
java/copilot-native/pom.xml— Module POM with:copilot-sdk-java-parentcom.github:copilot-sdk-java-runtimeexec-maven-pluginingenerate-resourcesphase: runsnpm pack @github/copilot-linux-x64@${project.version}tarextraction step totarget/native-staging/linux-x64/native/linux-x64/runtime.node${copilot.sdk.root}/nodejs/package-lock.jsonmaven-jar-pluginexecution producing placeholder primary JARmaven-jar-pluginexecution with<classifier>linux-x64</classifier>, packaging fromtarget/native-staging/linux-x64/build-helper-maven-pluginwiring prepared for future Gradle Module Metadata expansionjava/copilot-native/src/main/resources/native/lib/copilot-runtime.properties— Placeholder properties file:placeholder=true,version=${project.version}Platform properties for the classifier JAR — The build step must produce
native/linux-x64/platform.propertiescontaining:Files to modify
java/pom.xml(parent POM) — Uncomment/addcopilot-nativein<modules>. Ensurecopilot.sdk.rootproperty is defined so the native module can referencenodejs/package-lock.json.Gating tests and criteria
mvn package -pl copilot-nativeproduces thelinux-x64classifier JAR containingnative/linux-x64/runtime.node.native/lib/copilot-runtime.propertiesand NO native binaries.nodejs/package-lock.jsonmatches the downloaded.tgz.mvn clean verifyfromjava/runs the full reactor (including this module).mvn -pl sdk clean verifystill works (skipping the native module).mvn verifyfromjava/passes.Out of scope
linux-x64(deferred to later phase).copilot-native-allmodule) — deferred..module) file — deferred (wiring can be prepared but not activated).