Skip to content

Upgrade Java version to 21 across all build environments#4961

Merged
gchatelet merged 4 commits intomainfrom
switch_to_java21
Dec 23, 2025
Merged

Upgrade Java version to 21 across all build environments#4961
gchatelet merged 4 commits intomainfrom
switch_to_java21

Conversation

@gchatelet
Copy link
Collaborator

@gchatelet gchatelet commented Dec 20, 2025

Todo list to migrate to JDK 21

  • ci: bump workflow
  • bazel: bump bazelrc
  • ci: bump bazel docker
  • cmake: bump cmake/java.cmake
  • ci: bump cmake docker
  • java: bump ortools/java/*pom.xml.in
  • release: bump tools/release dockerfiles
  • release: bump tools/docker
  • release: update release machines
    • internal: bump internal machine setup documentation

@Mizux
Copy link
Collaborator

Mizux commented Dec 22, 2025

few notes:

  1. moving to openjdk21 in docker may not work as expected (sometime bazel doesn't catch it etc..)
    -> you may need 609b5db
    since docker job are only trigger on push -> need to monitor once merge and apply this fix if needed

  2. in java we set the jdk release in the pom.xml

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    maybe it's time to set it to 21 too or at least 11
    note: Actually java team failed the version support, and you need a third option on the cli --release IIRC so trying to build for 1.8 with 21. So while targeting 1.8 API you can have some byte code/implem relying on jdk11+ internal function...

  3. we also need to bump some tools/release manylinux docker, as well as tools/docker/[images,test] to built against 21 to be consistent when building release artifact...

@gchatelet
Copy link
Collaborator Author

For 1. this is now done at the .bazelrc level. So I think this is covered. Having a look at the rest.

@gchatelet
Copy link
Collaborator Author

Should be fixed, let me know if I missed something.

@gchatelet gchatelet merged commit 5c71023 into main Dec 23, 2025
21 of 22 checks passed
@gchatelet gchatelet deleted the switch_to_java21 branch December 23, 2025 11:15
gchatelet added a commit that referenced this pull request Dec 24, 2025
gchatelet added a commit that referenced this pull request Dec 24, 2025
gchatelet added a commit that referenced this pull request Dec 24, 2025
gchatelet added a commit that referenced this pull request Dec 27, 2025
This PR sets the `JAVA_HOME` env variable to `$JAVA_HOME_21_X64` so CMake and Maven picks up the right JVM for native CMake workflows.
@Mizux Mizux added this to the v10.0 Beta milestone Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants