Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ XXXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

- [ ] Read the [Contributing Guide](https://github.com/apolloconfig/apollo/blob/master/CONTRIBUTING.md) before making this pull request.
- [ ] Read the [Contributing Guide](https://github.com/apolloconfig/apollo-java/blob/main/CONTRIBUTING.md) before making this pull request.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Format your code with `mvn -B spotless:apply -Dmaven.gitcommitid.skip=true` and `mvn -B -f apollo-compat-tests/pom.xml spotless:apply -Dmaven.gitcommitid.skip=true`
- [ ] Write necessary unit tests to verify the code.
- [ ] Run `mvn clean test` to make sure this pull request doesn't break anything.
- [ ] Update the [`CHANGES` log](https://github.com/apolloconfig/apollo-java/blob/master/CHANGES.md).
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ jobs:
- name: Compile
run: mvn -B clean compile -Dmaven.gitcommitid.skip=true

code-style-check:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Make this a real merge gate.

Apollo master requires code-style-check in both Mergify queue rules and in branch protection. Apollo Java currently does neither, so this job may fail while the PR still satisfies the enforced merge conditions. Please add check-success = code-style-check to both queue rules; a maintainer should also add this context to the main required status checks before merge.

runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-spotless-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-spotless-
${{ runner.os }}-maven-
- name: Code Style Check
run: mvn -B spotless:check -Dmaven.gitcommitid.skip=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Check the separate compatibility-test reactor as well.

The root Maven reactor does not include apollo-compat-tests. On this head, mvn -B -fn -f apollo-compat-tests/pom.xml spotless:check -Dmaven.gitcommitid.skip=true fails in all three compatibility modules and reports five unformatted Java files. Please format those sources and add a second Spotless check for that reactor.

- name: Code Style Check (compat-tests reactor)

@nobodyiam nobodyiam Aug 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Please document why both Maven aggregation entry points must be handled.

This repository has two independent Maven reactor entry points:

  • The root pom.xml covers the regular Apollo Java modules.
  • apollo-compat-tests/pom.xml separately aggregates the API, Spring, and Spring Boot compatibility-test modules.

Because the root POM does not list apollo-compat-tests in its <modules>, running Spotless from the repository root never traverses those compatibility modules. Contributors can therefore run only the root command locally and still fail this CI step.

Please add an Apollo Java-specific CONTRIBUTING.md and update .github/PULL_REQUEST_TEMPLATE.md to link to it. The guide should explicitly document all four commands:

mvn -B spotless:apply -Dmaven.gitcommitid.skip=true
mvn -B -f apollo-compat-tests/pom.xml spotless:apply -Dmaven.gitcommitid.skip=true
mvn -B spotless:check -Dmaven.gitcommitid.skip=true
mvn -B -f apollo-compat-tests/pom.xml spotless:check -Dmaven.gitcommitid.skip=true

The Apollo server contributing guide currently linked by the PR template only documents the root mvn spotless:apply flow and also assumes the master branch, so it is not sufficient for this repository-specific gate.

run: mvn -B -f apollo-compat-tests/pom.xml spotless:check -Dmaven.gitcommitid.skip=true

unit-integration-pr:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target
# git
*.orig
.flattened-pom.xml

config-cache/
2 changes: 2 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ queue_rules:
- "check-success = compile-matrix (8)"
- "check-success = compile-matrix (11)"
- "check-success = compile-matrix (17)"
- "check-success = code-style-check"
- "check-success = unit-integration-pr"
- "check-success = compat-api"
- "check-success = compat-spring-spring-3.1.1-jdk8"
Expand All @@ -56,6 +57,7 @@ queue_rules:
- "check-success = compile-matrix (8)"
- "check-success = compile-matrix (11)"
- "check-success = compile-matrix (17)"
- "check-success = code-style-check"
- "check-success = unit-integration-pr"
- "check-success = compat-api"
- "check-success = compat-spring-spring-3.1.1-jdk8"
Expand Down
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to Apollo Java

Thanks for contributing to [apolloconfig/apollo-java](https://github.com/apolloconfig/apollo-java)! This
guide covers the project-specific steps needed before opening a pull request. The default branch of this
repository is `main`.

For general guidance on writing a good pull request description, see the
[Apollo server contributing guide](https://github.com/apolloconfig/apollo/blob/master/CONTRIBUTING.md) — note
that it documents the `apollo` (server) repository, so its build/format commands do not apply here.

## Building and testing

```bash
mvn clean test
```

## Code style (Spotless)

This repository is split across **two independent Maven reactors**:

- the root [`pom.xml`](pom.xml), which aggregates the regular client modules
(`apollo-core`, `apollo-client`, `apollo-client-config-data`, `apollo-mockserver`, `apollo-openapi`,
`apollo-plugin`);
- [`apollo-compat-tests/pom.xml`](apollo-compat-tests/pom.xml), which separately aggregates the
compatibility-test modules (`apollo-api-compat-it`, `apollo-spring-compat-it`,
`apollo-spring-boot-compat-it`).

The root POM's `<modules>` list does **not** include `apollo-compat-tests`, so running Spotless from the
repository root never touches the compatibility-test modules, and vice versa. CI checks both reactors as
separate steps, so you must format and check **both** before pushing — running only the root command will
pass locally and still fail CI.

Format your code:

```bash
mvn -B spotless:apply -Dmaven.gitcommitid.skip=true
mvn -B -f apollo-compat-tests/pom.xml spotless:apply -Dmaven.gitcommitid.skip=true
```

Verify formatting (this is what CI runs):

```bash
mvn -B spotless:check -Dmaven.gitcommitid.skip=true
mvn -B -f apollo-compat-tests/pom.xml spotless:check -Dmaven.gitcommitid.skip=true
```

## Updating the changelog

Update the [`CHANGES` log](CHANGES.md) to describe your change.
Loading
Loading