Skip to content

Commit 66fd1e5

Browse files
committed
fix(java): complete Maven module migration
Restore pre-migration dependency and plugin versions, publish correct child project metadata, and update repository consumers to the moved SDK paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
1 parent fd71ef3 commit 66fd1e5

10 files changed

Lines changed: 53 additions & 32 deletions

File tree

.githooks/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/bin/sh
22
#
33
# Pre-commit hook that runs Spotless check on the Java SDK when Java source
4-
# files are staged. Only triggers if changes exist under java/src/.
4+
# files are staged. Only triggers if changes exist under java/sdk/src/.
55
#
66
# To install this hook, run from the repository root:
77
# git config core.hooksPath .githooks
88
#
99

10-
# Only run Spotless if staged changes include Java source files under java/src/
11-
if ! git diff --cached --name-only | grep -q '^java/src/'; then
10+
# Only run Spotless if staged changes include Java source files under java/sdk/src/
11+
if ! git diff --cached --name-only | grep -q '^java/sdk/src/'; then
1212
exit 0
1313
fi
1414

.github/actions/java-test-report/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ inputs:
44
report-path:
55
description: "Path to the test report XML files (glob pattern)"
66
required: false
7-
default: "java/target/{surefire-reports*,failsafe-reports}/TEST-*.xml"
7+
default: "java/sdk/target/{surefire-reports*,failsafe-reports}/TEST-*.xml"
88
jacoco-path:
99
description: "Path to the JaCoCo XML report"
1010
required: false
11-
default: "java/target/site/jacoco-coverage/jacoco.xml"
11+
default: "java/sdk/target/site/jacoco-coverage/jacoco.xml"
1212
jacoco-csv-path:
1313
description: "Path to the JaCoCo CSV report"
1414
required: false
15-
default: "java/target/site/jacoco-coverage/jacoco.csv"
15+
default: "java/sdk/target/site/jacoco-coverage/jacoco.csv"
1616
check-name:
1717
description: "Name for the check run"
1818
required: false

.github/copilot-instructions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
- Top-level: `README.md` (architecture + quick start)
1313
- Language entry points: `nodejs/src/client.ts`, `python/README.md`, `go/README.md`, `dotnet/README.md`
14-
- Java: `java/README.md`, `java/pom.xml`
14+
- Java: `java/README.md`, `java/pom.xml`, `java/sdk/pom.xml`, `java/copilot-native/pom.xml`
1515
- Test harness & E2E: `test/harness/*`, Python harness wrapper `python/e2e/testharness/proxy.py`
1616
- Schemas & type generation: `nodejs/scripts/generate-session-types.ts`
1717
- Session snapshots used by E2E: `test/snapshots/` (used by the replay proxy)
@@ -39,7 +39,7 @@
3939
- E2E runs against a local **replaying CAPI proxy** (see `test/harness/server.ts`). Most language E2E harnesses spawn that server automatically (see `python/e2e/testharness/proxy.py`).
4040
- Tests rely on YAML snapshot exchanges under `test/snapshots/` — to add test scenarios, add or edit the appropriate YAML files and update tests.
4141
- The harness prints `Listening: http://...` — tests parse this URL to configure CLI or proxy.
42-
- Java E2E tests use `E2ETestContext` which manages a `CapiProxy` (Node.js replaying proxy). The harness is cloned during Maven's `generate-test-resources` phase to `java/target/copilot-sdk/`.
42+
- Java E2E tests use `E2ETestContext` which manages a `CapiProxy` (Node.js replaying proxy). The harness is cloned during Maven's `generate-test-resources` phase to `java/sdk/target/copilot-sdk/`.
4343
- Java test method names are converted to lowercase snake_case for snapshot filenames (avoids case collisions on macOS/Windows).
4444

4545
## Project-specific conventions & patterns ✅
@@ -61,13 +61,13 @@
6161

6262
## Where to add new code or tests 🧭
6363

64-
- SDK code: `nodejs/src`, `python/copilot`, `go`, `dotnet/src`, `rust/src`, `java/src/main/java`
65-
- Unit tests: `nodejs/test`, `python/*`, `go/*`, `dotnet/test`, `rust/tests`, `java/src/test/java`
66-
- E2E tests: `*/e2e/` folders that use the shared replay proxy and `test/snapshots/`, `java/src/test/java/**/e2e/`
67-
- Generated types: update schema in `@github/copilot` then run `cd nodejs && npm run generate:session-types` and commit generated files in `src/generated` or language generated location. Java generated types: `java/src/generated/java`
64+
- SDK code: `nodejs/src`, `python/copilot`, `go`, `dotnet/src`, `rust/src`, `java/sdk/src/main/java`
65+
- Unit tests: `nodejs/test`, `python/*`, `go/*`, `dotnet/test`, `rust/tests`, `java/sdk/src/test/java`
66+
- E2E tests: `*/e2e/` folders that use the shared replay proxy and `test/snapshots/`, `java/sdk/src/test/java/**/e2e/`
67+
- Generated types: update schema in `@github/copilot` then run `cd nodejs && npm run generate:session-types` and commit generated files in `src/generated` or language generated location. Java generated types: `java/sdk/src/generated/java`
6868

6969
## Boundaries — files you must NOT hand-edit ⛔
7070

71-
- `java/src/generated/java/` — auto-generated by `scripts/codegen/java.ts`; regenerate with `cd java && mvn generate-sources -Pcodegen`.
71+
- `java/sdk/src/generated/java/` — auto-generated by `scripts/codegen/java.ts`; regenerate with `cd java && mvn generate-sources -Pcodegen`.
7272
- `nodejs/src/generated/` — auto-generated by `npm run generate:session-types`.
7373
- `test/snapshots/` — authoritative test fixtures; add/edit YAML here to change E2E behavior, but don't delete without understanding downstream impact.

.github/skills/new-java-e2e-test-yaml-and-test/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ conversations:
5454

5555
### Step 3: Create the Java IT test class
5656

57-
Place it in `java/src/test/java/com/github/copilot/` with an `IT` suffix
57+
Place it in `java/sdk/src/test/java/com/github/copilot/` with an `IT` suffix
5858
(e.g., `MyFeatureIT.java`). The failsafe plugin picks up `*IT.java` files.
5959

6060
**Template:**
@@ -141,12 +141,12 @@ mvn clean verify
141141

142142
| What | Where |
143143
|------|-------|
144-
| Test context (manages proxy, workDir, CLI) | `java/src/test/java/com/github/copilot/E2ETestContext.java` |
145-
| Java proxy wrapper | `java/src/test/java/com/github/copilot/CapiProxy.java` |
144+
| Test context (manages proxy, workDir, CLI) | `java/sdk/src/test/java/com/github/copilot/E2ETestContext.java` |
145+
| Java proxy wrapper | `java/sdk/src/test/java/com/github/copilot/CapiProxy.java` |
146146
| Replay proxy (TypeScript) | `test/harness/replayingCapiProxy.ts` |
147147
| Proxy server entry point | `test/harness/server.ts` |
148148
| Snapshot files | `test/snapshots/<category>/<name>.yaml` |
149-
| Existing IT tests for reference | `java/src/test/java/com/github/copilot/*IT.java` |
149+
| Existing IT tests for reference | `java/sdk/src/test/java/com/github/copilot/*IT.java` |
150150

151151
## How the Proxy Matches Requests
152152

.github/workflows/java-smoke-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
The SDK has already been built and installed into the local Maven repository.
6464
JDK 17 and Maven are already installed and on PATH.
6565
66-
Execute the prompt at `src/test/prompts/PROMPT-smoke-test.md` with the following critical overrides:
66+
Execute the prompt at `sdk/src/test/prompts/PROMPT-smoke-test.md` with the following critical overrides:
6767
6868
**Critical override — disable SNAPSHOT updates (but allow downloads):** The goal of this workflow is to validate the SDK SNAPSHOT that was just built and installed locally, not any newer SNAPSHOT that might exist in a remote repository. To ensure Maven does not download a newer timestamped SNAPSHOT of the SDK while still allowing it to download any missing plugins or dependencies, you must run the smoke-test Maven build without `-U` and with `--no-snapshot-updates`, so that it uses the locally installed SDK artifact. Use `mvn --no-snapshot-updates clean package` instead of `mvn -U clean package` or `mvn -o clean package`.
6969
@@ -136,7 +136,7 @@ jobs:
136136
The SDK has already been built and installed into the local Maven repository.
137137
JDK 25 and Maven are already installed and on PATH.
138138
139-
Execute the prompt at `src/test/prompts/PROMPT-smoke-test.md` with the following critical overrides:
139+
Execute the prompt at `sdk/src/test/prompts/PROMPT-smoke-test.md` with the following critical overrides:
140140
141141
**Critical override — disable SNAPSHOT updates (but allow downloads):** The goal of this workflow is to validate the SDK SNAPSHOT that was just built and installed locally, not any newer SNAPSHOT that might exist in a remote repository. To ensure Maven does not download a newer timestamped SNAPSHOT of the SDK while still allowing it to download any missing plugins or dependencies, you must run the smoke-test Maven build without `-U` and with `--no-snapshot-updates`, so that it uses the locally installed SDK artifact. Use `mvn --no-snapshot-updates clean package` instead of `mvn -U clean package` or `mvn -o clean package`.
142142

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ docs/.validation/
1414
*.csproj.lscache
1515

1616
# Java
17-
java/target
17+
java/**/target/
1818
java/smoke-test
1919
java/.classpath
2020
java/.project

java/copilot-native/pom.xml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
<name>GitHub Copilot SDK :: Java :: Native Runtime</name>
2020
<description>Native runtime binaries for the GitHub Copilot Java SDK, published as per-platform classifier JARs</description>
21+
<url>https://github.com/github/copilot-sdk</url>
22+
23+
<scm>
24+
<connection>scm:git:https://github.com/github/copilot-sdk.git</connection>
25+
<developerConnection>scm:git:https://github.com/github/copilot-sdk.git</developerConnection>
26+
<url>https://github.com/github/copilot-sdk</url>
27+
<tag>HEAD</tag>
28+
</scm>
2129

2230
<properties>
2331
<!--
@@ -105,7 +113,8 @@
105113
<executions>
106114
<!--
107115
Additional classifier JAR containing
108-
native/<classifier>/runtime.node and
116+
native/<classifier>/runtime.node,
117+
native/<classifier>/copilot, and
109118
native/<classifier>/platform.properties.
110119
-->
111120
<execution>
@@ -155,7 +164,8 @@
155164
</plugin>
156165
<!--
157166
Structural guards: assert that the classifier JAR carries the
158-
native binary and that the placeholder JAR does not.
167+
complete native artifact set and that the placeholder JAR does
168+
not carry the native binary.
159169
-->
160170
<plugin>
161171
<groupId>org.apache.maven.plugins</groupId>

java/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<plugin>
8585
<groupId>org.apache.maven.plugins</groupId>
8686
<artifactId>maven-jar-plugin</artifactId>
87-
<version>3.5.0</version>
87+
<version>3.5.1</version>
8888
</plugin>
8989
<plugin>
9090
<groupId>org.apache.maven.plugins</groupId>
@@ -139,7 +139,7 @@
139139
<plugin>
140140
<groupId>com.github.spotbugs</groupId>
141141
<artifactId>spotbugs-maven-plugin</artifactId>
142-
<version>4.10.2.0</version>
142+
<version>4.10.3.0</version>
143143
</plugin>
144144
<plugin>
145145
<groupId>com.diffplug.spotless</groupId>
@@ -164,7 +164,7 @@
164164
<plugin>
165165
<groupId>org.sonatype.central</groupId>
166166
<artifactId>central-publishing-maven-plugin</artifactId>
167-
<version>0.10.0</version>
167+
<version>0.11.0</version>
168168
</plugin>
169169
<plugin>
170170
<groupId>org.codehaus.mojo</groupId>

java/sdk/pom.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818

1919
<name>GitHub Copilot SDK :: Java</name>
2020
<description>Official SDK for programmatic control of GitHub Copilot CLI</description>
21+
<url>https://github.com/github/copilot-sdk</url>
22+
23+
<scm>
24+
<connection>scm:git:https://github.com/github/copilot-sdk.git</connection>
25+
<developerConnection>scm:git:https://github.com/github/copilot-sdk.git</developerConnection>
26+
<url>https://github.com/github/copilot-sdk</url>
27+
<tag>HEAD</tag>
28+
</scm>
2129

2230
<distributionManagement>
2331
<snapshotRepository>
@@ -81,7 +89,7 @@
8189
<dependency>
8290
<groupId>com.fasterxml.jackson.core</groupId>
8391
<artifactId>jackson-databind</artifactId>
84-
<version>2.22.0</version>
92+
<version>2.22.1</version>
8593
</dependency>
8694
<dependency>
8795
<groupId>com.fasterxml.jackson.core</groupId>
@@ -91,14 +99,14 @@
9199
<dependency>
92100
<groupId>com.fasterxml.jackson.datatype</groupId>
93101
<artifactId>jackson-datatype-jsr310</artifactId>
94-
<version>2.22.0</version>
102+
<version>2.22.1</version>
95103
</dependency>
96104

97105
<!-- SpotBugs annotations for suppressing warnings -->
98106
<dependency>
99107
<groupId>com.github.spotbugs</groupId>
100108
<artifactId>spotbugs-annotations</artifactId>
101-
<version>4.10.2</version>
109+
<version>4.10.3</version>
102110
<scope>provided</scope>
103111
</dependency>
104112

scripts/docs-validation/validate.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,16 @@ async function validateJava(): Promise<ValidationResult[]> {
385385
fs.copyFileSync(path.join(javaDir, file), path.join(srcDir, file));
386386
}
387387

388-
// Read the SDK version from java/pom.xml
389-
const sdkPomPath = path.join(ROOT_DIR, "java", "pom.xml");
388+
// Read the inherited SDK version from java/sdk/pom.xml
389+
const sdkPomPath = path.join(ROOT_DIR, "java", "sdk", "pom.xml");
390390
const sdkPomContent = fs.readFileSync(sdkPomPath, "utf-8");
391391
const versionMatch = sdkPomContent.match(
392-
/<artifactId>copilot-sdk-java<\/artifactId>\s*<version>([^<]+)<\/version>/,
392+
/<parent>[\s\S]*?<version>([^<]+)<\/version>[\s\S]*?<\/parent>/,
393393
);
394-
const sdkVersion = versionMatch ? versionMatch[1] : "1.0.0-SNAPSHOT";
394+
if (!versionMatch) {
395+
throw new Error(`Could not read the Java SDK version from ${sdkPomPath}`);
396+
}
397+
const sdkVersion = versionMatch[1];
395398

396399
// Create pom.xml that references the local SDK
397400
const pomXml = `<?xml version="1.0" encoding="UTF-8"?>

0 commit comments

Comments
 (0)