Skip to content

Conversation

@joonseolee
Copy link
Contributor

@joonseolee joonseolee commented Aug 7, 2025

Pull Request

Related issue

Fixes #869

What does this PR do?

  • Upgraded JDK and Spotless versions following the Gradle upgrade.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary by CodeRabbit

  • Chores

    • Bumped required Java compatibility to Java 17 and adjusted packaging name declaration.
    • Updated build tooling: Gradle wrapper to 9.0.0, Spotless plugin and google-java-format upgraded.
    • Upgraded CI toolchain to Java 17 (Temurin) and switched Docker packaging image to Java 17.
  • Documentation

    • README updated to reflect JDK 17+ compatibility.
  • Tests

    • Adjusted integration test expectation to reflect Java 17 behavior.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

Build and CI configuration updated: Gradle wrapper → 9.0.0, project Java toolchain → Java 17, Spotless and google-java-format upgraded, deprecated archivesBaseName replaced, Docker Compose and GitHub Actions switched to JDK 17, and one test expectation changed to InaccessibleObjectException.

Changes

Cohort / File(s) Change Summary
Gradle Build Configuration
build.gradle
Bumped sourceCompatibility/targetCompatibility 1.8 → 17, migrated archivesBaseNamebase { archivesName.set(...) }, upgraded Spotless plugin (6.13.0 → 6.25.0) and google-java-format (1.7 → 1.10.0, AOSP).
Gradle Wrapper
gradle/wrapper/gradle-wrapper.properties
Updated distributionUrl from Gradle 8.14.1 → 9.0.0.
CI Workflows
.github/workflows/pre-release-tests.yml,
.github/workflows/tests.yml
Updated GitHub Actions Java setup from Java 8 (zulu) → Java 17 (temurin) in both workflows.
Docker / Packaging
docker-compose.yml
Changed package service image from azul/zulu-openjdk:11-latestazul/zulu-openjdk:17-latest.
Docs
README.md
Updated compatibility table: "JDK 8 and above" → "JDK 17 and above".
Tests
src/test/java/com/meilisearch/integration/ClientTest.java
Adjusted expected exception from StackOverflowErrorInaccessibleObjectException in a Gson serialization test; added import.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Repo as Git Repository
    participant CI as GitHub Actions (Temurin/17)
    participant Gradle as Gradle Wrapper (9.0.0)
    participant Docker as Docker Compose (OpenJDK 17)

    Dev->>Repo: push changes (build/CI/tooling updates)
    Repo->>CI: trigger workflows
    CI->>CI: Set up Java 17 (temurin)
    CI->>Gradle: run build/test with Gradle 9
    Note right of Gradle: Spotless 6.25.0\ngoogle-java-format 1.10.0 applied
    Dev->>Docker: docker-compose up package
    Docker->>Docker: start container using OpenJDK 17 image
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

maintenance

"I hopped the CI and build with a grin,
Gradle leapt to nine and Java found new skin.
Spotless polishes code with a neat little thud,
Containers wake in seventeen, all snug in the mud.
🐇✨"

Pre-merge checks (5 passed)

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Upgrade Gradle to 9 along with JDK and Spotless" concisely and accurately summarizes the primary change set—upgrading the Gradle wrapper to 9.0.0 and updating the JDK and Spotless configuration—which matches the changes in build.gradle, the Gradle wrapper, CI workflows, and Spotless config.
Linked Issues Check ✅ Passed The PR implements the linked issue’s goals by updating the Gradle wrapper to 9.0.0, raising project source/target compatibility to Java 17, migrating the deprecated archivesBaseName usage, upgrading Spotless, and adjusting CI/docker images to use JDK 17; a test expectation was also updated to reflect JDK 17 behavior. These coding changes address the primary causes of the "Gradle requires JVM 17" CI failure and tackle key Gradle 9 compatibility items. I recommend running the full CI and integration tests under the updated toolchain to confirm there are no remaining incompatibilities.
Out of Scope Changes Check ✅ Passed All modified files are directly related to the Gradle 9 / JDK 17 migration (gradle wrapper, build.gradle toolchain and Spotless, GitHub Actions workflows, docker-compose, README, and one test change) and I do not observe unrelated feature work or refactors introduced in this changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docker-compose.yml (1)

3-3: Pin the JDK image to a fixed patch tag for reproducible builds

azul/zulu-openjdk:17-latest floats to whatever Azul ships next. This can break CI the day a new 17.x patch appears (e.g. 17.0.20 → 17.0.22). Prefer a deterministic tag such as:

-    image: azul/zulu-openjdk:17-latest
+    image: azul/zulu-openjdk:17.0.22

You still get security updates by bumping the tag deliberately and reviewing the diff.

build.gradle (1)

22-24: Avoid duplicated archive naming – keep it in one place

You now set the base archive name twice:

  1. base { archivesName.set('meilisearch-java') } (new)
  2. buildJar { archiveBaseName = 'meilisearch-java' } (existing)

If one of them drifts, you’ll get two differently-named JARs in build/libs. Drop one (prefer the base block) or reference project.archiveBaseName inside the custom task to stay DRY.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34e6053 and 7f9bf6c.

📒 Files selected for processing (3)
  • build.gradle (3 hunks)
  • docker-compose.yml (1 hunks)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
🔇 Additional comments (4)
gradle/wrapper/gradle-wrapper.properties (1)

3-3: Confirm wrapper JAR + plugin stack are really Gradle 9-ready

distributionUrl now targets Gradle 9 GA. Make sure:

  1. gradle/wrapper/gradle-wrapper.jar was regenerated (./gradlew wrapper --gradle-version 9.0.0) and committed; otherwise CI will still download the old bootstrapper.
  2. All applied plugins (Spotless 6.25.0, nexus-publish, etc.) were tested against Gradle 9 to catch any runtime incompatibilities early.

A quick smoke-run locally or in CI should surface problems, but please double-check before merging.

build.gradle (3)

16-17: Spotless upgrade looks good

Bumping to 6.25.0 is required for Gradle 9 and has no breaking changes for Java formatters.


123-124: Java 17 target – validate dependency compatibility

Raising sourceCompatibility/targetCompatibility to 17 is aligned with the new Docker image, but a few dependencies (e.g. json:20250517, jackson-databind:2.19.0) historically lag behind latest JDKs. Please run the full test matrix on JDK 17 before merging to ensure no reflective-access or module-system issues surface.


199-199: Formatter bump acknowledged

Updating Google Java Format to 1.10.0 (AOSP) syncs with Spotless 6.x; no concerns.

@curquiza curquiza added the breaking-change The related changes are breaking for the users label Aug 26, 2025
@curquiza
Copy link
Member

@joonseolee thank you for your PR

Can you fix the tests?

Run ./gradlew build integrationTest --info
Downloading https://services.gradle.org/distributions/gradle-9.0.0-bin.zip
............10%.............20%.............30%.............40%.............50%............60%.............70%.............80%.............90%.............100%
Initialized native services in: /home/runner/.gradle/native
Initialized jansi services in: /home/runner/.gradle/native

Welcome to Gradle 9.0.0!

Here are the highlights of this release:
 - Configuration Cache is the recommended execution mode
 - Gradle requires JVM 17 or higher to run
 - Build scripts use Kotlin 2.2 and Groovy 4.0
 - Improved Kotlin DSL script compilation avoidance

For more details see https://docs.gradle.org/9.0.0/release-notes.html

Removing 0 daemon stop events from registry
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Gradle requires JVM 17 or later to run. Your build is currently configured to use JVM 8.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org./
Error: Process completed with exit code 1.
Run ./gradlew build integrationTest --info
Downloading https://services.gradle.org/distributions/gradle-9.0.0-bin.zip
............10%.............20%.............30%.............40%.............50%............60%.............70%.............80%.............90%.............100%
Initialized native services in: /home/runner/.gradle/native
Initialized jansi services in: /home/runner/.gradle/native

Welcome to Gradle 9.0.0!

Here are the highlights of this release:
 - Configuration Cache is the recommended execution mode
 - Gradle requires JVM 17 or higher to run
 - Build scripts use Kotlin 2.2 and Groovy 4.0
 - Improved Kotlin DSL script compilation avoidance

For more details see https://docs.gradle.org/9.0.0/release-notes.html

Removing 0 daemon stop events from registry
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Gradle requires JVM 17 or later to run. Your build is currently configured to use JVM 8.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org./```

@joonseolee joonseolee force-pushed the chore/upgrade-gradle branch from 7f9bf6c to e1a11fc Compare August 27, 2025 04:27
@joonseolee
Copy link
Contributor Author

@curquiza

Do you mind if I ask you check it again?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/tests.yml (1)

49-53: Linter job aligned to JDK 17.

Spotless/format tasks will now run on the same toolchain as the build. Consider adding Gradle’s official setup step for better caching and wrapper verification (optional).

Add after “Set up Java”:

- name: Setup Gradle
  uses: gradle/actions/setup-gradle@v3
  with:
    cache-read-only: ${{ github.ref != 'refs/heads/main' }}
src/test/java/com/meilisearch/integration/ClientTest.java (2)

322-327: Make the failing-serialization assertion resilient and fix misleading var name.

The specific exception can vary across JDK/Gson versions. Also, the variable name suggests “transient excluded” while it excludes only STATIC.

Apply:

-        Gson gsonWithTransient =
-                new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC).create();
+        Gson gsonStaticOnly =
+                new GsonBuilder().excludeFieldsWithModifiers(Modifier.STATIC).create();

-        Assertions.assertThrows(InaccessibleObjectException.class, () -> gsonWithTransient.toJson(test));
+        Throwable thrown = Assertions.assertThrows(Throwable.class, () -> gsonStaticOnly.toJson(test));
+        assertThat(
+                thrown,
+                anyOf(
+                        instanceOf(InaccessibleObjectException.class),
+                        instanceOf(JsonIOException.class),
+                        instanceOf(StackOverflowError.class)));

Alternatively, keep the strict assertion but add a brief comment explaining why STATIC (not TRANSIENT) is used to demonstrate the failure case.


3-6: Minor consistency: avoid mixing static and class-qualified Assertions.

Either use static imports consistently (assertThrows/assertDoesNotThrow) or the Assertions class everywhere.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7f9bf6c and e1a11fc.

📒 Files selected for processing (7)
  • .github/workflows/pre-release-tests.yml (1 hunks)
  • .github/workflows/tests.yml (2 hunks)
  • README.md (1 hunks)
  • build.gradle (3 hunks)
  • docker-compose.yml (1 hunks)
  • gradle/wrapper/gradle-wrapper.properties (1 hunks)
  • src/test/java/com/meilisearch/integration/ClientTest.java (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • gradle/wrapper/gradle-wrapper.properties
  • docker-compose.yml
  • build.gradle
🔇 Additional comments (3)
.github/workflows/pre-release-tests.yml (1)

20-21: All JDK 8 references removed—workflows now fully on JDK 17

  • Switched .github/workflows/pre-release-tests.yml to java-version: 17 with distribution: 'temurin', which unblocks Gradle 9 on CI and resolves the “Gradle requires JVM 17” error.
  • Ran a global search across all workflows for any remaining java-version: 8, 1.8 or distribution: 'zulu' patterns—no matches found.
  • No other CI workflows are pinning JDK 8.
.github/workflows/tests.yml (1)

24-25: Good: tests job now uses JDK 17 (Temurin).

This aligns CI with Gradle 9’s minimum and should resolve the earlier failure.

src/test/java/com/meilisearch/integration/ClientTest.java (1)

16-16: Import of InaccessibleObjectException is correct for JDK 17+.

@joonseolee
Copy link
Contributor Author

@curquiza

Could you check it again? :)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/tests.yml (2)

24-26: Good fix: JDK 17 aligns with Gradle 9 and should resolve the JVM 8 CI failure.

Optional CI hardening suggestions:

  • Add Gradle wrapper validation and the Gradle Build Action for better caching and safety.
  • Add a short wait-for-health after starting Meilisearch to reduce flakes.

Apply incrementally as needed:

       - uses: actions/checkout@v5
+      - name: Validate Gradle Wrapper
+        uses: gradle/actions/wrapper-validation@v4
       - name: Set up Java
         uses: actions/setup-java@v5
         with:
           java-version: 17
           distribution: 'temurin'
           cache: gradle
+      - name: Setup Gradle
+        uses: gradle/actions/setup-gradle@v4
+        with:
+          cache-read-only: ${{ github.event_name == 'pull_request' }}
       - name: Grant execute permission for gradlew
         run: chmod +x gradlew
       - name: Meilisearch (latest) setup with Docker
         run: docker run -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --master-key=masterKey --no-analytics
+      - name: Wait for Meilisearch health
+        run: |
+          for i in {1..30}; do
+            if curl -sf http://127.0.0.1:7700/health >/dev/null; then exit 0; fi
+            sleep 1
+          done
+          echo "Meilisearch not healthy" >&2; exit 1

Also consider pinning the Meilisearch image to a specific version instead of latest to avoid surprise breakages.


49-49: LGTM on switching the linter job to JDK 17.

If scripts/lint.sh invokes Gradle/Spotless, enable Gradle cache here too.

       - name: Set up JDK 17
         uses: actions/setup-java@v5
         with:
           java-version: 17
           distribution: 'temurin'
+          cache: gradle

Also applies to: 52-53

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f6ac99 and de9f5cd.

📒 Files selected for processing (2)
  • .github/workflows/pre-release-tests.yml (1 hunks)
  • .github/workflows/tests.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pre-release-tests.yml

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

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

bors merge

@curquiza curquiza merged commit beef83d into meilisearch:main Sep 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change The related changes are breaking for the users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Gradle v9

2 participants