chore(run): upgrade hellfix(cloud-run): CloudRun/HelloWorld upgrade to Java25 along Docker#10276
Conversation
There was a problem hiding this comment.
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.
|
LGTM. |
|
|
||
| @RunWith(SpringRunner.class) | ||
| @SpringBootTest | ||
| @SpringBootTest(classes = HelloworldApplication.class) |
There was a problem hiding this comment.
I think with the new update it is safe to remove the @RunWith annotation which looks obsolete in JUnit5 and also change it like
| @SpringBootTest(classes = HelloworldApplication.class) | |
| @SpringBootTest |
Following this docs: https://docs.spring.io/spring-boot/3.5/reference/testing/spring-boot-applications.html
Description
Fixes: b/470273769
Upgrade the Hello World Cloud Run sample to Java 25. This includes:
shared-configurationversion to1.2.2.25.3.5.0to match compatibility requirements for Java 25.eclipse-temurin:25-jre-alpine.Dockerfileto usemaven:3-eclipse-temurin-25-alpinefor the builder stage andeclipse-temurin:25-jre-alpinefor the runner stage.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.targetandmaven.compiler.sourceto 21 in pom.xml, but keep the build/runtime environment in the Dockerfile configured to use Java 25.Checklist
pom.xmlparent set to latestshared-configurationmvn clean verifyrequiredmvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory only (Note: fails under JDK 25 compiler withIllegalAccessErroron unnamed module/ErrorProne access tocom.sun.tools.javac.api.BasicJavacTask)