Skip to content

chore(run): upgrade hellfix(cloud-run): CloudRun/HelloWorld upgrade to Java25 along Docker#10276

Open
Kef131 wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
Kef131:fix(clourd_run)-_cloud_run_helloword_upgrade_java25
Open

chore(run): upgrade hellfix(cloud-run): CloudRun/HelloWorld upgrade to Java25 along Docker#10276
Kef131 wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
Kef131:fix(clourd_run)-_cloud_run_helloword_upgrade_java25

Conversation

@Kef131
Copy link
Copy Markdown
Contributor

@Kef131 Kef131 commented Jun 3, 2026

Description

Fixes: b/470273769

Upgrade the Hello World Cloud Run sample to Java 25. This includes:

  • Updating parent shared-configuration version to 1.2.2.
  • Updating compiler source and target versions to 25.
  • Updating Spring Boot version to 3.5.0 to match compatibility requirements for Java 25.
  • Updating Jib plugin configuration to build from eclipse-temurin:25-jre-alpine.
  • Updating the multi-stage Dockerfile to use maven:3-eclipse-temurin-25-alpine for the builder stage and eclipse-temurin:25-jre-alpine for the runner stage.
  • Fixing unit tests bootstrap issue under Spring Boot 3.5.0 by specifying the test context class HelloworldApplication.class.

Notes
Here we have an issue with Kokoro when upgrading samples to Java25
Kokoro fails on both Java 11 and Java 17 presubmit builds, caused by the same issue: the repository's test runner (btlr ) does not yet support Java version 25 as a compiler target in pom.xml, and fails immediately when encountering it.

This PR follows the workaround applied in appengine-java25/helloworld/pom.xml and flexible/java-25/websocket-jetty/pom.xml ) which is using Java 21 Target in POM

We would set maven.compiler.target and maven.compiler.source to 21 in pom.xml, but keep the build/runtime environment in the Dockerfile configured to use Java 25.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only (Note: fails under JDK 25 compiler with IllegalAccessError on unnamed module/ErrorProne access to com.sun.tools.javac.api.BasicJavacTask)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label Bot added api: run Issues related to the Cloud Run API. samples Issues that are directly related to samples. labels Jun 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request attempts to upgrade the project to Java 25 and Spring Boot 3.5.0, configures the JaCoCo plugin, updates the Jib plugin base image, and adjusts the test configuration. However, the reviewer notes that Java 25 and Spring Boot 3.5.0 are not yet generally available (GA). This will cause build and compilation failures because the required Docker images and dependencies do not exist. The reviewer recommends downgrading to Java 21 (LTS) and a stable Spring Boot 3.x version (such as 3.4.2) across the Dockerfile, Maven compiler properties, and Jib configuration.

Comment thread run/helloworld/Dockerfile
Comment thread run/helloworld/Dockerfile
Comment thread run/helloworld/pom.xml Outdated
Comment thread run/helloworld/pom.xml
@Kef131 Kef131 marked this pull request as ready for review June 3, 2026 22:03
@Kef131 Kef131 requested review from a team and yoshi-approver as code owners June 3, 2026 22:03
@XrossFox
Copy link
Copy Markdown

XrossFox commented Jun 3, 2026

LGTM.

Copy link
Copy Markdown
Contributor

@angelcaamal angelcaamal left a comment

Choose a reason for hiding this comment

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

LGTM!


@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(classes = HelloworldApplication.class)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think with the new update it is safe to remove the @RunWith annotation which looks obsolete in JUnit5 and also change it like

Suggested change
@SpringBootTest(classes = HelloworldApplication.class)
@SpringBootTest

Following this docs: https://docs.spring.io/spring-boot/3.5/reference/testing/spring-boot-applications.html

Comment thread run/helloworld/Dockerfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: run Issues related to the Cloud Run API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants