Skip to content

Commit 5c71023

Browse files
authored
Upgrade Java version to 21 across all build environments (#4961)
1 parent 9edab82 commit 5c71023

36 files changed

+61
-64
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ build --define absl=1
2323
# Fix the python version
2424
build --@rules_python//python/config_settings:python_version=3.12
2525

26+
# Fix the Java version
27+
build --java_language_version=21 # Version of the source files
28+
build --java_runtime_version=remotejdk_21 # Hermetic JRE
29+
2630
###############################################################################
2731
# Per plaform options
2832
###############################################################################

.github/workflows/amd64_macos_bazel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ jobs:
3333
runs-on: macos-15-intel
3434
steps:
3535
- uses: actions/checkout@v6
36-
- name: Set Java to OpenJDK 17 (Temurin)
36+
- name: Set Java to OpenJDK 21 (Temurin)
3737
uses: actions/setup-java@v5
3838
with:
3939
distribution: 'temurin'
40-
java-version: '17'
40+
java-version: '21'
4141
- name: Check mvn
4242
run: mvn --version
4343
- name: Setup Python

.github/workflows/amd64_windows_bazel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- uses: actions/setup-java@v5
3737
with:
3838
distribution: 'temurin'
39-
java-version: '17'
39+
java-version: '21'
4040
- name: Check java
4141
run: java -version
4242
- name: Check mvn

.github/workflows/arm64_macos_bazel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ jobs:
3333
runs-on: macos-latest # macos arm64 based runner
3434
steps:
3535
- uses: actions/checkout@v6
36-
- name: Set Java to OpenJDK 17 (Temurin)
36+
- name: Set Java to OpenJDK 21 (Temurin)
3737
uses: actions/setup-java@v5
3838
with:
3939
distribution: 'temurin'
40-
java-version: '17'
40+
java-version: '21'
4141
- name: Check mvn
4242
run: mvn --version
4343
- name: Setup Python

.github/workflows/presubmit.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
env:
1414
PYTHON_VERSION: '3.12'
1515
JAVA_DISTRIBUTION: 'temurin'
16-
JAVA_VERSION: '17'
16+
JAVA_VERSION: '21'
1717

1818
jobs:
1919
###############################################################################
@@ -33,10 +33,6 @@ jobs:
3333
runs-on: ${{matrix.os}}
3434
steps:
3535
- uses: actions/checkout@v6
36-
- uses: actions/setup-java@v5
37-
with:
38-
distribution: ${{env.JAVA_DISTRIBUTION}}
39-
java-version: ${{env.JAVA_VERSION}}
4036
- uses: actions/setup-python@v6
4137
with:
4238
python-version: ${{env.PYTHON_VERSION}}

bazel/docker/fedora/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ COPY . .
3636

3737
FROM devel AS build
3838
RUN bazel version
39-
RUN bazel build --java_runtime_version=remotejdk_21 --config=ci //ortools/... //examples/...
39+
RUN bazel build --config=ci //ortools/... //examples/...
4040

4141
FROM build AS test
42-
RUN bazel test --java_runtime_version=remotejdk_21 --config=ci //ortools/... //examples/...
42+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/opensuse/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-
1818

1919
# Install Java JDK and Maven
2020
RUN zypper refresh \
21-
&& zypper install -y java-17-openjdk-devel maven \
21+
&& zypper install -y java-21-openjdk-devel maven \
2222
&& zypper clean -a
2323
ENV PATH=/usr/share/maven/bin:$PATH
2424

bazel/docker/rockylinux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-linux-
2222

2323
# Install Java
2424
RUN dnf -y update \
25-
&& dnf -y install java-11-openjdk java-11-openjdk-devel maven \
25+
&& dnf -y install java-21-openjdk java-21-openjdk-devel maven \
2626
&& dnf clean all
2727
ENV JAVA_HOME=/usr/lib/jvm/java-openjdk
2828

cmake/docker/alpine/java.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ortools/cmake:alpine_swig AS env
22

3-
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
4-
RUN apk add --no-cache openjdk8 maven
3+
ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk
4+
RUN apk add --no-cache openjdk21 maven
55

66
FROM env AS devel
77
WORKDIR /home/project

cmake/docker/opensuse/java.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ortools/cmake:opensuse_swig AS env
22

33
# Install Java JDK and Maven
44
RUN zypper refresh \
5-
&& zypper install -y java-17-openjdk-devel maven \
5+
&& zypper install -y java-21-openjdk-devel maven \
66
&& zypper clean -a
77
ENV PATH=/usr/share/maven/bin:$PATH
88

0 commit comments

Comments
 (0)