diff --git a/docs/split-client-contribution.md b/docs/split-client-contribution.md index 83167eac2196..f352012bff8f 100644 --- a/docs/split-client-contribution.md +++ b/docs/split-client-contribution.md @@ -18,50 +18,67 @@ limitations under the License. Use this guide with the [contributor guide](https://shenyu.apache.org/community/contributor-guide/) and the [issue and pull request conventions](https://shenyu.apache.org/community/issue-pr/). -It describes the migration tracked by [#6373](https://github.com/apache/shenyu/issues/6373). +The migration policy is tracked by [#7602](https://github.com/apache/shenyu/issues/7602). +This guide follows up on [#6373](https://github.com/apache/shenyu/issues/6373) and +[#8419](https://github.com/apache/shenyu/issues/8419). ## Choose the repository -The split [Java client repository](https://github.com/apache/shenyu-client-java) lets -applications register with ShenYu while keeping a Java 8 and Spring Boot 2 baseline. -Admin and gateway development in this repository uses Java 17 and Spring Boot 3. -Keeping these build baselines separate lets client changes be developed and tested -without requiring a business application to adopt the gateway's JDK baseline. +The migration targets Java 17 / Spring Boot 3, with Java 21 verification following +main's compatibility policy. First identify the implementation that your change +or application actually uses. The historical external default branch and the +migration candidate have different requirements. -| Change | Repository | +The following source state was checked on 2026-11-12: + +| Implementation | Source and baseline | Contribution status | +| --- | --- | --- | +| Historical external `main` | [POM at `8b93088973bf`](https://github.com/apache/shenyu-client-java/blob/8b93088973bf9f8f50d614e708bb87f662b707d5/pom.xml): Java 8, Boot 2.7.18, `2.7.0.1-jdk8-SNAPSHOT` | Still the external default branch at this check; use only for explicitly scoped historical maintenance | +| Main repository's in-tree clients | [Main POM](../pom.xml): Java 17 / Boot 3; `2.7.3-SNAPSHOT` at `149dba492033ae215331e09096f5129a2363d6fb` | Clients, starters and client-facing examples remain in main pending the release gates | +| External migration candidate | [POM at `a37668298ede`](https://github.com/apache/shenyu-client-java/blob/a37668298edef5c501e8b56a0595ed50ef895656/pom.xml): Java 17, Boot 3.3.1, `2.7.2-migration-SNAPSHOT` | [PR #16](https://github.com/apache/shenyu-client-java/pull/16) is draft and unmerged; this preparation candidate is not a published client release | + +Recheck the issue, PR and current POM before starting work. A default-branch checkout +does not contain an unmerged candidate. The [compatibility matrix](java-client-compatibility.md) +preserves dated evidence for specific commits; its historical rows do not set the +baseline for new migration contributions or certify newer commits. + +| Change | Repository and scope | | --- | --- | -| Java 8 client annotations, registration code, auto-configuration, or client starters | `apache/shenyu-client-java` | -| Admin registration endpoints, persistence, validation, or gateway behavior | `apache/shenyu` | -| Registration payload or behavior that changes both producer and consumer | Coordinated changes in both repositories | +| Migrating business-client annotations, registration, auto-configuration, starters or client-dependent examples | `apache/shenyu-client-java`, on the migration work identified by #7602 and the relevant PR | +| Fix to client code still staged in the main reactor | `apache/shenyu`; identify whether the external candidate also needs the fix | +| Explicit maintenance of the historical Java 8 implementation | `apache/shenyu-client-java`, on the historical branch selected by its issue | +| Admin, gateway, registration protocol or shared foundations | `apache/shenyu` | +| Registration wire changes affecting both producer and consumer | Coordinated changes in both repositories | | Published website documentation | `apache/shenyu-website` | -The main reactor still includes `shenyu-client`, `shenyu-register-center`, and -client starters. The split is a migration, not a completed removal of those modules. -The in-tree client modules remain part of the main repository CI build scope. -Check which artifact and version the application actually consumes before choosing -a repository. A fix to the split client does not automatically fix its in-tree -counterpart; describe whether the affected implementation also needs a corresponding -change. Do not move unrelated runtime code into the client repository. +In-tree clients remain part of main's build scope during preparation. They are not +a second long-term implementation to maintain after migration. A change in one +implementation does not automatically update another; describe the affected +artifacts and coordinate any required counterpart change. ## JDK and framework baselines -| Build | Baseline | Verification configuration | +| Build | Baseline | Verification guidance | | --- | --- | --- | -| Main repository | `java.version=17`, Spring Boot 3 | Main CI builds on JDK 17 | -| Split Java client | `java.version=1.8`, Spring Boot 2 | Client CI runs `./mvnw -B clean test` on JDK 8, 17, 21, 23, and 25 | - -Read each repository's `pom.xml` and `.github/workflows/ci.yml` before updating these -values. The client matrix specifies which JDKs CI attempts to test; it is not a -claim that every job passed or that every client/admin release combination works. -Link the actual workflow results and record the tested commits in a PR. -Do not override `java.version` when running the matrix: the client must retain its -Java 8 source and bytecode baseline even when Maven runs under a newer JDK. - -The split client's [migration progress](https://github.com/apache/shenyu-client-java/blob/main/progress.md) -records build evidence and remaining integration work. Use the version compatibility -matrix requested in [#6370](https://github.com/apache/shenyu/issues/6370) for -release-pair support decisions once it is available; do not infer a supported pair -from similar version numbers. +| Main repository and in-tree clients | Java 17 / Spring Boot 3 | JDK 17 checks and main's Java 21 compatibility lane | +| External migration candidate | Java 17 / Spring Boot 3 | Build migrated clients, starters and examples on JDK 17; verify JDK 21 under the migration policy | +| Historical external Java 8 implementation only | Java 8 / Spring Boot 2.7.18 | Its pinned CI matrix tests on JDK 8, 17, 21, 23 and 25; this is not the migration matrix | + +Read the selected POM and workflow: [main CI](../.github/workflows/ci.yml), +[candidate CI](https://github.com/apache/shenyu-client-java/blob/a37668298edef5c501e8b56a0595ed50ef895656/.github/workflows/ci.yml), +or [historical CI](https://github.com/apache/shenyu-client-java/blob/8b93088973bf9f8f50d614e708bb87f662b707d5/.github/workflows/ci.yml). +Their triggers can differ: the pinned candidate runs its Java 21 jobs on pushes, +while main's workflow also selects some PRs for full compatibility checks. +Do not override `java.version` to change the selected implementation's baseline. + +Record local source results, hosted CI results and released client/Admin/bootstrap +verification separately. Configured or skipped jobs are not passing results; link +actual runs for the tested commit. A successful source build does not establish a +supported release pair, and matching Maven versions do not establish compatibility. +Use the [existing matrix](java-client-compatibility.md#version-compatibility-matrix) +and [release checklist](../shenyu-dist/README.md#release-compatibility-checklist) +for support claims. Keeping legacy headerless registration compatible does not +require the new client implementation to run on Java 8. ## Set up a contribution @@ -75,146 +92,210 @@ git fetch upstream git switch -c docs/split-client-contribution upstream/master ``` -For a client contribution, use your fork of `shenyu-client-java`, set its upstream to -`https://github.com/apache/shenyu-client-java.git`, and branch from `upstream/main`. -Keep your fork's default branch for upstream synchronization and develop on a -separate branch. Find or open an issue describing the change and check its comments -and related PRs before duplicating work. +For an external client contribution, use your fork of `shenyu-client-java` and set +upstream to `https://github.com/apache/shenyu-client-java.git`. Choose the starting +point according to the issue: + +- Historical maintenance can branch from the applicable historical `upstream/main` + commit after checking its POM. +- For migration work, inspect #7602 and the relevant candidate PR first. At the + check above, #16 uses `yangjj-iso/shenyu-client-java` branch + `fix/7602-java17-migration-preparation`, head `a37668298ede`. Fetch the PR's head + and compare the full commit with its POM and preparation guide; branching from + the historical `upstream/main` does not select that implementation. Agree the + contribution target with the existing migration work before duplicating it. -Both repositories provide `./mvnw`. Set `JAVA_HOME` to the JDK for that build and -put `$JAVA_HOME/bin` first in `PATH`. Confirm the selected runtime with -`./mvnw -version`; a locally installed `mvn` is not required. +Keep the fork's default branch for synchronization and work on a separate branch. +Both repositories provide `./mvnw`. Set `JAVA_HOME` to the selected JDK, put +`$JAVA_HOME/bin` first in `PATH`, and confirm with `./mvnw -version`. +Use `mvnw.cmd` on Windows; a locally installed Maven is not required. ## Build and test the split client -Run from the root of the split client checkout: +### Java 17 migration candidate + +The commands below apply to candidate #16 at the pinned commit, from its checkout +root. Follow its [preparation guide](https://github.com/apache/shenyu-client-java/blob/a37668298edef5c501e8b56a0595ed50ef895656/docs/MIGRATION.md) +when the candidate changes. First select JDK 17 and prepare its main-owned dependencies: ```sh ./mvnw -version -./mvnw -B clean test -./mvnw -B clean install -Dmaven.javadoc.skip=true +python3 script/prepare-foundations.py +./mvnw -B -ntp clean verify -Pexamples -Dmaven.javadoc.skip=true -Djacoco.skip=true -Ddocker.skip=true ``` -For a focused Spring MVC starter change, build its dependencies too: +The preparation script builds only the main-owned foundations listed in the +candidate's manifest, from its pinned main commit using main's wrapper. It installs +them locally and skips their tests; this step is not main test verification or +publication. The temporary client and foundation versions are separate. Release +POMs must use real published foundation versions before deployment is enabled. + +After preparing foundations, a focused Spring MVC starter check is: ```sh -./mvnw -B -pl shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc -am clean test +./mvnw -B -pl shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc -am test ``` -The focused build does not replace the complete client CI matrix. To repeat that -matrix locally, install all five JDKs and set these variables to their JDK home -directories. Run this from the client root: +The focused check does not replace the complete candidate build. To repeat the +client verification on Java 17 and 21, set `JDK17_HOME` and `JDK21_HOME` to their +installed JDK directories and run from the candidate root: ```sh -for client_jdk in "$JDK8_HOME" "$JDK17_HOME" "$JDK21_HOME" "$JDK23_HOME" "$JDK25_HOME"; do - test -x "$client_jdk/bin/java" || { echo "Missing client matrix JDK: $client_jdk"; exit 1; } +for client_jdk in "$JDK17_HOME" "$JDK21_HOME"; do + test -x "$client_jdk/bin/java" || { echo "Missing verification JDK: $client_jdk"; exit 1; } JAVA_HOME="$client_jdk" PATH="$client_jdk/bin:$PATH" ./mvnw -version || exit 1 - JAVA_HOME="$client_jdk" PATH="$client_jdk/bin:$PATH" ./mvnw -B clean test || exit 1 + JAVA_HOME="$client_jdk" PATH="$client_jdk/bin:$PATH" ./mvnw -B -ntp clean verify \ + -Pexamples -Dmaven.javadoc.skip=true -Djacoco.skip=true -Ddocker.skip=true || exit 1 done ``` -Capture each result separately so failures can be tied to a JDK. If a JDK is not -available locally, report that gap and inspect the matching CI job. A successful -`-DskipTests` build does not verify test behavior. +Capture each result separately. Report unavailable JDKs and unverified CI jobs; +`-DskipTests` builds do not verify behavior. The candidate's guide also describes +its client-owned source-runtime runner. Those source checks remain separate from +verification against released Admin/bootstrap images. + +### Historical Java 8 maintenance only + +For an issue explicitly targeting the historical implementation, retain its Java 8 +source/bytecode and Boot 2 baseline. From that checkout root, use its wrapper: + +```sh +./mvnw -version +./mvnw -B clean test +./mvnw -B clean install -Dmaven.javadoc.skip=true +``` + +Repeat the tests under the JDKs specified by that historical commit's CI without +changing `java.version`. Its [migration record](https://github.com/apache/shenyu-client-java/blob/8b93088973bf9f8f50d614e708bb87f662b707d5/progress.md) +and historical compatibility evidence apply only to that implementation. Do not +carry its copied infrastructure or Java 8 requirement into the Java 17 migration. ## Test local client artifacts with admin and the gateway -1. In the split client checkout, run `./mvnw -B clean install -Dmaven.javadoc.skip=true`. - Record its commit and the `` in its root POM. This installs that version - in your local Maven repository; it does not change the main reactor's artifacts. -2. In a separate Spring Boot 2 test application, select the split client's starter - and set an explicit version matching the installed artifacts. For Spring MVC, - the artifact is `org.apache.shenyu:shenyu-spring-boot-starter-client-springmvc`. - Use the same version for other split client artifacts in that application. -3. Inspect the application's resolved dependencies before running it: +For behavior changes, select the required registration and routing scenarios from +the [cross-repository test strategy](cross-repo-compatibility-testing.md). For the +migration candidate, use its moved examples/source-runtime runner or a separate +Java 17 / Boot 3 test application. The following manual workflow uses a separate +application; an explicitly selected historical client instead requires compatible +Boot 2 application dependencies. + +1. Prepare the client dependencies as above. In the selected client checkout, run + `./mvnw -B clean install -Dmaven.javadoc.skip=true`. Record the commit and root + POM version. Unlike `verify`, `install` makes the client artifacts available to + a separate local application; it does not change main's reactor dependencies. +2. Select the client's starter and its exact installed version in the application. + For Spring MVC, use `org.apache.shenyu:shenyu-spring-boot-starter-client-springmvc`. + Keep client artifacts from the same client release together; do not force shared + foundations to have the same version as the independent client. +3. Inspect the application's resolved dependencies: ```sh - ./mvnw dependency:tree -Dincludes=org.apache.shenyu + ./mvnw dependency:tree '-Dincludes=org.apache.shenyu:*' ``` - Confirm the selected client version and that an in-tree client or another - transitive dependency has not replaced it. The main repository's examples use - its own dependency management; building an unchanged example does not prove - that the split client was exercised. Do not replace a Spring Boot 3 example's - starter with the Spring Boot 2 client and assume framework compatibility. -4. Build the main checkout with JDK 17: + Confirm that the intended client and foundations were selected. Main's + [examples](../shenyu-examples/README.md) use its own in-tree client version; + building them does not verify the external candidate. Do not inject an external + client into main's examples or assume Boot 2/Boot 3 starter compatibility. +4. For a source-to-source check, build a separate main checkout with JDK 17: ```sh ./mvnw -B clean install -Dmaven.javadoc.skip=true ``` - Start admin and bootstrap using the [local deployment guide](https://shenyu.apache.org/docs/deployment/deployment-local/). - Use a test environment and record the main commit, active profiles, registration - channel, and sync channel. Configure admin and the gateway to use the same sync - settings and enable the plugin needed by the application. -5. Configure the test application's `shenyu.register.registerType`, - `shenyu.register.serverLists`, and channel-specific properties for that environment. - With HTTP registration, `serverLists` points to admin, not the gateway, and the - client reads credentials from `shenyu.register.props.username` and - `shenyu.register.props.password`. Use the credentials required by your test admin. -6. Start the application. Verify that metadata and URI registration succeed, inspect - the resulting selector/rule/upstream in admin, and call the registered route through - the gateway. Compare its response with a direct request to the application. - Exercise deregistration or heartbeat/discovery changes when the patch affects - those paths. For API-doc or MCP changes, also verify their corresponding registration - and downstream behavior; a basic HTTP route does not cover those features. - -Save the application dependency tree and the client/admin/gateway observations as -verification evidence. Client unit tests alone cannot establish client-to-admin -wire compatibility or successful gateway routing. + Start Admin and bootstrap using the [local deployment guide](https://shenyu.apache.org/docs/deployment/deployment-local/). + Record the main commit, profiles, registration and sync channels. Configure matching + sync settings and the required gateway plugin. For released-pair verification, + select the released images and versions required by the compatibility matrix instead; + a local main build cannot certify that release pair. +5. Configure `shenyu.register.registerType`, `shenyu.register.serverLists` and the + channel-specific properties. For HTTP registration, `serverLists` points to Admin, + not the gateway. Configure `shenyu.register.props.username` and + `shenyu.register.props.password` for the test Admin without committing credentials. +6. Start the application. Verify metadata and URI registration, the resulting + selector/rule/upstream in Admin, and a proxied request against the direct backend + response. Exercise offline, heartbeat or discovery changes when affected. Verify + API-doc, MCP and RPC behavior separately when claimed; a basic HTTP route does + not cover them. + +Save the dependency tree and client/Admin/gateway observations. Unit tests alone +cannot establish deployment compatibility. Documentation corrections do not require +new release certification; report the checks actually relevant to the change. ## Coordinate changes across repositories -HTTP registration crosses the repository boundary as JSON. The split client defines -its registration DTOs in `shenyu-client-core`; admin handles incoming registration -in `ShenyuClientHttpRegistryController` and uses its own DTOs. Compare serialized -field names, types, required values, authentication, and responses rather than -assuming the Java package names must match. - -A client-only implementation fix that preserves the registration contract generally -needs a client PR. An admin-only fix that preserves accepted client requests generally -needs a main PR. Changes to required fields, endpoints, response semantics, or -registration lifecycle need an explicit compatibility decision and coordinated PRs -when both sides must change. - -For coordinated work: - -- Cross-link the issue and both PRs, and describe which side can be deployed first. -- Preserve old-client/new-admin behavior where required, and test new-client/old-admin - behavior or clearly describe the unsupported combination. -- Add producer-side serialization or registration tests and consumer-side parsing, - validation, and persistence tests for the changed contract. -- Run a real registration and gateway check with the intended pair of commits. -- Record any rollout constraints and update compatibility documentation when a - supported combination changes. Track a protocol proposal separately from behavior - already present on the default branches. +The migration's dependency direction is +`shenyu-client-java -> released apache/shenyu protocol/foundation artifacts`. +Main owns the [registration protocol](../shenyu-register-center/shenyu-register-protocol/README.md), +including wire DTOs and fixtures, and shared common/register/registry foundations. +The client consumes these artifacts; do not recreate historical client-local DTO, +common, timer or registry copies. Java package names do not determine ownership. +Compare wire fields, types, defaults, authentication and responses when changing +the contract, and retain legacy v1 receiver compatibility. + +Follow the [ownership inventory](java-client-repository-boundary.md#inventory-and-migration-baseline): +`shenyu-register-client-beat` and `shenyu-spring-boot-starter-client-beat` stay in main +because they serve gateway heartbeat behavior. `shenyu-sdk` and SDK starters are +outside this split, even when a client-dependent example moves. Main-owned code, +tests, bootstrap and retained examples must not depend on independent client artifacts. + +A client-only implementation fix preserving the contract generally needs a client +PR; an Admin-only fix preserving accepted requests generally needs a main PR. +Changes to required fields, endpoints, responses or registration lifecycle need an +explicit compatibility decision and coordinated PRs when both sides must change: + +- Cross-link the issue and PRs, and explain deployment order. +- Preserve old-client/new-Admin behavior where required; test new-client/old-Admin + behavior or document the unsupported combination. +- Add producer serialization/registration tests and main-owned consumer fixtures, + validation and persistence tests without importing client classes into main. +- Run the relevant registration and gateway checks with the intended commits. +- Update compatibility evidence when supported combinations change. Breaking wire + changes require protocol versioning and transition support, not synchronized releases. + +### Release gates + +Follow the [migration release order](../shenyu-register-center/CLIENT_MIGRATION.md#release-order-and-gates) +and [release checklist](../shenyu-dist/README.md#release-compatibility-checklist): +release main-owned protocol/foundations first, publish the external client only +after ownership handoff and compatibility verification, and remove staged main +sources last. Each artifact coordinate must have one release owner. Candidate +SNAPSHOTs, local source checks and closed documentation issues do not satisfy these +gates. Use the migration guide's rollback rules rather than adding a reverse +client dependency to main. ## PR checklists -For a split client PR: +For an external migration client PR: + +- [ ] Link the issue and identify the candidate branch, commit and affected artifacts. +- [ ] Keep Java 17 / Boot 3 and main-owned protocol/foundation ownership. +- [ ] Preserve relevant client/starter tests and add regression tests for behavior changes. +- [ ] Verify Java 17 and Java 21, reporting local results and hosted CI outcomes separately. +- [ ] Prepare required foundations and run the applicable complete build and the + repository's PR-template checks; report missing or failed checks explicitly. +- [ ] For registration changes, record the Admin/gateway pair and integration results; + link coordinated main changes and distinguish source checks from released-pair evidence. -- [ ] Follow the contribution guidelines and link the relevant issue. -- [ ] Keep Java 8 source compatibility and the Spring Boot 2 baseline. -- [ ] Add regression tests for changed behavior and run the affected module tests. -- [ ] Check the JDK 8/17/21/23/25 matrix and report any unverified jobs. -- [ ] Run `./mvnw clean install -Dmaven.javadoc.skip=true`, or explicitly report why - it has not completed in the repository's PR template. -- [ ] For registration changes, record the admin/gateway commit pair and integration - results; link a main-repository PR if the consumer must change. +For historical maintenance, explicitly identify the historical branch, retain its +Java 8 / Boot 2 baseline and check its pinned JDK matrix instead of applying the +migration candidate's build instructions. Do not describe that work as completing +#7602's migration. For a main-repository PR affecting clients: -- [ ] Identify affected in-tree and split client artifacts and the wire contract. -- [ ] Add regression tests for the admin or gateway behavior and retained compatibility. -- [ ] Build and test with JDK 17 and complete the main repository's PR template. -- [ ] Verify the intended client/admin pair, including older clients where required. -- [ ] Link coordinated client changes and explain rollout order or version constraints. - -For example, a client documentation commit can use -`docs(client): document split client contribution workflow.` -A corresponding PR title is -`[ISSUE #6373] Document split client migration and contribution workflow.` -Push the branch to your fork and open the PR against the upstream default branch. -Describe the final change and the checks actually run. Leave unfinished checks +- [ ] Identify affected in-tree and external candidate artifacts and the wire contract. +- [ ] Preserve main's ownership and one-way dependency boundary, including beat and SDK modules. +- [ ] Add tests for changed behavior and retained compatibility; for documentation, + check factual claims, links and commands without claiming unrun runtime verification. +- [ ] Build with JDK 17, check the applicable Java 21 lane and complete the current + PR template, including `./mvnw clean install -Dmaven.javadoc.skip=true`. +- [ ] Verify affected client/Admin scenarios and explain coordinated changes and rollout order. + +For example, a documentation commit can use +`docs(client): correct split client migration guidance.` with PR title +`[ISSUE #8419] Correct split client migration guidance.` +Push the branch to your fork and open the PR against the target selected for the +issue. Describe the final change and checks actually run. Leave unfinished checks unchecked, respond to review on the same branch, and inspect CI before requesting -merge. Labels, milestones, review, and merge are handled with the project's maintainers. +merge. Labels, milestones, review and merge remain with the project's maintainers. diff --git a/shenyu-examples/README.md b/shenyu-examples/README.md index 5d1e013d8e1a..3dc43935da08 100644 --- a/shenyu-examples/README.md +++ b/shenyu-examples/README.md @@ -4,23 +4,24 @@ This module contains example applications that demonstrate how to integrate your ## Client Dependencies -The example modules consume **independent [shenyu-client-java](https://github.com/apache/shenyu-client-java) artifacts** from Maven Central, rather than depending on in-tree source modules from the main `apache/shenyu` repository. - -This reflects the recommended approach for real users: add the ShenYu client library as an external Maven dependency. +During the [Java client migration](../shenyu-register-center/CLIENT_MIGRATION.md), +these examples use the client modules still staged in the main `apache/shenyu` +repository. Build their dependencies from the same checkout. The examples do not +select artifacts from the independent `shenyu-client-java` repository. ### How It Works -The parent POM (`shenyu-examples/pom.xml`) defines a property: - -```xml -2.7.0.3 -``` - -All `shenyu-client-*` and `shenyu-spring-boot-starter-client-*` dependencies in individual example POMs are managed by this property through the `` section. The version is inherited automatically — individual examples do not specify a `` for these artifacts. +The [examples parent POM](pom.xml) manages the client and client-starter dependencies +below with `${project.version}`. The examples form a separate Maven reactor from +main, so install the required main modules before building an example. Both reactors +must use the same checkout version. -The released version remains the default so a clean standalone checkout can resolve the client artifacts from Maven Central. To test unreleased MCP fixes, explicitly override this property as described below. +The former `shenyu.client.java.version` property is no longer used by this POM. +Passing it on the command line does not select a different client. To verify an +external migration candidate, use its own examples or a separate test application +as described in the [contribution guide](../docs/split-client-contribution.md). -### Which Artifacts Are Consumed Externally +### Client Artifacts Used by the Examples | Client Artifact | Used By | |----------------|---------| @@ -34,138 +35,117 @@ The released version remains the default so a clean standalone checkout can reso ### Internal Example Dependencies -The following dependencies remain internal to this repository (`${project.version}`): +The following dependencies also remain main-owned (`${project.version}`): - `shenyu-examples-common` — shared example utilities - `shenyu-examples-dubbo-api` — Dubbo API definitions -- `shenyu-sdk-*` — ShenYu SDK modules (not extracted to shenyu-client-java) -- `shenyu-spring-boot-starter-sdk-*` — ShenYu SDK starters (not extracted to shenyu-client-java) +- `shenyu-sdk-*` — ShenYu SDK modules, outside the client split +- `shenyu-spring-boot-starter-sdk-*` — ShenYu SDK starters, outside the client split -## Testing the MCP Example with 2.7.2-SNAPSHOT +Client-dependent examples may move with the migration; that does not transfer +ownership of SDK modules. See the [ownership inventory](../docs/java-client-repository-boundary.md#inventory-and-migration-baseline). -Use JDK 17 and run the following commands from the root of this `apache/shenyu` checkout. Use a checkout containing the MCP fixes: installing an unrelated snapshot from `shenyu-client-java` does not provide the changes in this repository. +## Testing the MCP Example from This Checkout + +Use JDK 17 / Spring Boot 3 and run all commands below from the root of this +`apache/shenyu` checkout. Confirm the selected runtime with `./mvnw -version`. +Use `mvnw.cmd` on Windows. A lower compiler target in an individual example POM +does not establish Java 8 support for its Boot 3 application and dependencies. ### Build and Run the MCP Example -The MCP example uses both the MCP and Spring MVC client starters. Build both starters and their required reactor modules into the local Maven repository: +The MCP example needs both MCP and Spring MVC client starters. Build them and their +required main modules into the local Maven repository: ```bash -./mvnw install -pl shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-mcp,shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc -am -DskipTests +./mvnw install -pl shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-mcp,shenyu-spring-boot-starter/shenyu-spring-boot-starter-client/shenyu-spring-boot-starter-client-springmvc -am -DskipTests -Dmaven.javadoc.skip=true ``` -Build the MCP example and its shared example utilities using the separate examples reactor: +Build the example and its shared utilities using the separate examples reactor: ```bash -./mvnw -f shenyu-examples/pom.xml install -pl shenyu-examples-mcp -am \ - -Dshenyu.client.java.version=2.7.2-SNAPSHOT -DskipTests +./mvnw -f shenyu-examples/pom.xml install -pl shenyu-examples-mcp -am -DskipTests ``` -Before starting the example, configure `shenyu-examples/shenyu-examples-mcp/src/main/resources/application.yml` for your ShenYu Admin address, credentials, namespace, and reachable service address. Run ShenYu Admin and Bootstrap from a checkout containing the corresponding MCP gateway fixes. +These commands prepare artifacts and skip test execution; they are not behavior +verification. Check the resolved dependencies before running the example: ```bash -./mvnw -f shenyu-examples/pom.xml spring-boot:run -pl shenyu-examples-mcp \ - -Dshenyu.client.java.version=2.7.2-SNAPSHOT +./mvnw -f shenyu-examples/pom.xml dependency:tree -pl shenyu-examples-mcp '-Dincludes=org.apache.shenyu:*' ``` -Keep the same version override for build and run commands. This selects `2.7.2-SNAPSHOT` for both starters through the parent dependency management. Check the resolved ShenYu dependencies with: +Confirm that both starters and shared client dependencies use this checkout's +version, as declared in the root and examples POMs, rather than a historical JDK8 +client or an external migration candidate. + +Configure [application.yml](shenyu-examples-mcp/src/main/resources/application.yml) +for the test Admin address, credentials, namespace and reachable service address. +Run Admin and bootstrap with compatible registration, sync and MCP gateway settings. +Then start the example: ```bash -./mvnw -f shenyu-examples/pom.xml dependency:tree -pl shenyu-examples-mcp \ - -Dshenyu.client.java.version=2.7.2-SNAPSHOT '-Dincludes=org.apache.shenyu:*' +./mvnw -f shenyu-examples/pom.xml spring-boot:run -pl shenyu-examples-mcp ``` -Confirm that the selected MCP and Spring MVC starters and their shared client dependencies use `2.7.2-SNAPSHOT`. Then verify that the example registers its upstream and MCP tools in ShenYu Admin and that a tool invocation through the gateway succeeds. - -Other examples continue to use the released `2.7.0.3` default and do not require this override. +Verify that its upstream and MCP tools register in Admin and that an actual tool +invocation through the gateway succeeds. A successful build alone does not prove +registration or routing. ## Testing with Other Unreleased Client Artifacts -When developing or testing changes to the `shenyu-client-java` library, you may need to build the client artifacts locally and use them in these examples. - -### Option 1: Override the Version via Command Line +For changes to in-tree clients, build the relevant main modules and examples from +the same checkout as above. For `shenyu-client-java` migration work, select the +candidate identified by its issue/PR and follow its preparation guide through the +[split-client contribution workflow](../docs/split-client-contribution.md#build-and-test-the-split-client). +Do not inject external clients into main's examples or add a version override to +bypass the one-way dependency boundary. Historical Java 8 / Boot 2 instructions +apply only to explicitly selected historical implementations, not these examples. -Build the `shenyu-client-java` project locally, install the artifacts to your local Maven repository: +## Verification -```bash -git clone https://github.com/apache/shenyu-client-java.git -cd shenyu-client-java -mvn clean install -DskipTests -``` +### Prerequisites -This installs the artifacts with the project's snapshot version (e.g., `2.7.0.1-jdk8-SNAPSHOT`). Then, build the examples using that version: +For a general example, first install its required main modules. If they have not +already been built, a complete main build installs them and runs the main tests: ```bash -# Run from the apache/shenyu repository root; select the example to test. -mvn -f shenyu-examples/pom.xml clean install -pl shenyu-examples-springmvc -am \ - -Dshenyu.client.java.version=2.7.0.1-jdk8-SNAPSHOT +./mvnw clean install -Dmaven.javadoc.skip=true ``` -### Option 2: Modify the Property in Parent POM - -For a more permanent change during development, edit the `` property in `shenyu-examples/pom.xml`: - -```xml -2.7.0.1-jdk8-SNAPSHOT -``` - -> **Note**: Locally installed snapshots do not require a remote snapshot repository. If the required snapshot has been published, you can configure the Apache Snapshot Repository in your POM or an active profile in `settings.xml` (inside ``): -> ```xml -> -> apache-snapshots -> https://repository.apache.org/content/repositories/snapshots/ -> -> true -> -> -> ``` - -### Option 3: Use Maven `-U` Flag for Latest Snapshots - -If the snapshot has been published to the Apache snapshot repository: +Then build the selected example and its example dependencies. For Spring MVC: ```bash -mvn -f shenyu-examples/pom.xml clean install -pl shenyu-examples-springmvc -am \ - -Dshenyu.client.java.version=2.7.0.1-jdk8-SNAPSHOT -U +./mvnw -f shenyu-examples/pom.xml install -pl shenyu-examples-springmvc -am -DskipTests ``` -The `-U` flag forces Maven to check for updated snapshots. It does not publish missing artifacts or replace the local build required for unpublished fixes. - -## Verification - -After updating the client version, verify that the examples can register with a local ShenYu Admin and Bootstrap. - -### Prerequisites - -After preparing the client dependencies as described above, install the shared example utilities and their parent POM to your local Maven repository: - -```bash -cd shenyu-examples -mvn install -pl shenyu-examples-common -am -DskipTests -``` +Installing only `shenyu-examples-common` does not prepare all main client, SDK or +protocol dependencies. For another example, select its actual module path and +build its dependencies before starting it. ### Run Examples -Run the example from the `shenyu-examples` reactor root using `-pl`. The run command uses the internal dependencies installed in the previous step: +From the main repository root, run the prepared Spring MVC example: ```bash -cd shenyu-examples - -# Spring MVC HTTP example -mvn spring-boot:run -pl shenyu-examples-springmvc - -# Or other protocol examples: -# mvn spring-boot:run -pl shenyu-examples-grpc -# mvn spring-boot:run -pl shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service -# mvn spring-boot:run -pl shenyu-examples-websocket/shenyu-example-spring-annotation-websocket -# mvn spring-boot:run -pl shenyu-examples-mcp +./mvnw -f shenyu-examples/pom.xml spring-boot:run -pl shenyu-examples-springmvc ``` -> **Note**: `-pl` selects an example but does not build its dependencies. Install the required internal modules before running it. If you used a client version override when building, pass the same override to `spring-boot:run`. +`spring-boot:run -pl` selects an application; it does not build and install missing +reactor dependencies. Configure that application's Admin address and credentials +and start Admin/bootstrap with matching sync settings and the required plugin first. ### Confirm Registration After the application starts: -1. Open the ShenYu Admin console (default: `http://localhost:9095`) -2. Check that the service appears under **Divide** (for HTTP), **Dubbo**, **gRPC**, or the respective plugin list -3. Verify API calls can be proxied through the ShenYu gateway (default: `http://localhost:9195`) +1. Inspect its registered metadata, URI and resulting selector/rule/upstream in Admin + (default: `http://localhost:9095`). +2. Verify a request through the gateway (default: `http://localhost:9195`) and compare + the response with a direct backend request. For MCP, also invoke the registered tools. +3. Exercise heartbeat, offline or discovery behavior when the change affects it. + +Record commits, resolved dependency versions, JDKs, registration/sync channels and +observed results. These source checks do not certify a released client/Admin pair; +use the [compatibility matrix](../docs/java-client-compatibility.md) and +[release gates](../shenyu-register-center/CLIENT_MIGRATION.md#release-order-and-gates) +for published support claims.