Skip to content

Commit 997b483

Browse files
[FLINK-36181] Use Java 17 by default (#25898)
* [FLINK-36181] Set CI to use Java 17 by default and drop Java 8 * [FLINK-36181] Update main POM to use Java 17 * [FLINK-36181] Bump Scala to 2.12.20 This is a breaking change for Flink 2.0, and allows us to next remove the specific Scala versions for both Java 17 and 21 * [FLINK-36181] Build Dockerfiles with Java 17 by default * [FLINK-36181] Remove Scala version bump for Java11 and Java17 profiles Since we've bumped Scala all together, we no longer need to bump it for these profiles * [FLINK-36181] Add Java11 target profile * [FLINK-36181] Set CI to have a dedicated Java11 cron * [FLINK-36181] Update README * [FLINK-36181] Make sure that JDK11 APIs can be used * [FLINK-36181] Improve README * [FLINK-36181] Address review comment on configurable Java version * [FLINK-36181] Remove no longer required specific Scala parameters
1 parent 8af0259 commit 997b483

File tree

12 files changed

+100
-68
lines changed

12 files changed

+100
-68
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
name: "Pre-compile Checks"
3030
uses: ./.github/workflows/template.pre-compile-checks.yml
3131
ci:
32-
name: "Default (Java 11)"
32+
name: "Default (Java 17)"
3333
uses: ./.github/workflows/template.flink-ci.yml
3434
with:
35-
environment: 'PROFILE="-Dinclude_hadoop_aws"'
36-
jdk_version: 11
35+
environment: 'PROFILE="-Dinclude_hadoop_aws -Djdk17 -Pjava17-target"'
36+
jdk_version: 17
3737
secrets:
3838
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
3939
s3_access_key: ${{ secrets.IT_CASE_S3_ACCESS_KEY }}

.github/workflows/nightly.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,12 @@ jobs:
3939
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
4040
s3_access_key: ${{ secrets.IT_CASE_S3_ACCESS_KEY }}
4141
s3_secret_key: ${{ secrets.IT_CASE_S3_SECRET_KEY }}
42-
java17:
43-
name: "Java 17"
44-
uses: ./.github/workflows/template.flink-ci.yml
45-
with:
46-
workflow-caller-id: java17
47-
environment: 'PROFILE="-Dinclude_hadoop_aws -Djdk11 -Djdk17 -Pjava17-target"'
48-
jdk_version: 17
49-
secrets:
50-
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
51-
s3_access_key: ${{ secrets.IT_CASE_S3_ACCESS_KEY }}
52-
s3_secret_key: ${{ secrets.IT_CASE_S3_SECRET_KEY }}
5342
java21:
5443
name: "Java 21"
5544
uses: ./.github/workflows/template.flink-ci.yml
5645
with:
5746
workflow-caller-id: java21
58-
environment: 'PROFILE="-Dinclude_hadoop_aws -Djdk11 -Djdk17 -Djdk21 -Pjava21-target"'
47+
environment: 'PROFILE="-Dinclude_hadoop_aws -Djdk21 -Pjava21-target"'
5948
jdk_version: 21
6049
secrets:
6150
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
@@ -66,8 +55,8 @@ jobs:
6655
uses: ./.github/workflows/template.flink-ci.yml
6756
with:
6857
workflow-caller-id: hadoop313
69-
environment: 'PROFILE="-Dflink.hadoop.version=3.2.3 -Phadoop3-tests,hive3"'
70-
jdk_version: 11
58+
environment: 'PROFILE="-Dflink.hadoop.version=3.2.3 -Phadoop3-tests,hive3 -Djdk17 -Pjava17-target"'
59+
jdk_version: 17
7160
secrets:
7261
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
7362
s3_access_key: ${{ secrets.IT_CASE_S3_ACCESS_KEY }}
@@ -77,8 +66,8 @@ jobs:
7766
uses: ./.github/workflows/template.flink-ci.yml
7867
with:
7968
workflow-caller-id: adaptive-scheduler
80-
environment: 'PROFILE="-Penable-adaptive-scheduler"'
81-
jdk_version: 11
69+
environment: 'PROFILE="-Penable-adaptive-scheduler -Djdk17 -Pjava17-target"'
70+
jdk_version: 17
8271
secrets:
8372
s3_bucket: ${{ secrets.IT_CASE_S3_BUCKET }}
8473
s3_access_key: ${{ secrets.IT_CASE_S3_ACCESS_KEY }}

.github/workflows/template.flink-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ on:
3030
type: string
3131
jdk_version:
3232
description: "The Java version to use."
33-
default: 11
33+
default: 17
3434
type: number
3535
secrets:
3636
s3_bucket:

.github/workflows/template.pre-compile-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ on:
2323
inputs:
2424
jdk_version:
2525
description: "The JDK version that shall be used as a default within the Flink CI Docker container."
26-
default: "11"
26+
default: "17"
2727
type: choice
2828
options: ["11", "17", "21"]
2929

3030
workflow_call:
3131
inputs:
3232
jdk_version:
3333
description: "The JDK version that shall be used as a default within the Flink CI Docker container."
34-
default: 11
34+
default: 17
3535
type: number
3636

3737
permissions: read-all

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,46 @@ Prerequisites for building Flink:
104104
* Unix-like environment (we use Linux, Mac OS X, Cygwin, WSL)
105105
* Git
106106
* Maven (we require version 3.8.6)
107-
* Java 11
107+
* Java (version 11, 17, or 21)
108+
109+
### Basic Build Instructions
110+
111+
First, clone the repository:
108112

109113
```
110114
git clone https://github.com/apache/flink.git
111115
cd flink
112-
./mvnw clean package -DskipTests # this will take up to 10 minutes
113116
```
114117

115-
Flink is now installed in `build-target`.
118+
Then, choose one of the following commands based on your preferred Java version:
119+
120+
**For Java 11**
121+
122+
```
123+
./mvnw clean package -DskipTests -Djdk11 -Pjava11-target
124+
```
125+
126+
**For Java 17 (Default)**
127+
128+
```
129+
./mvnw clean package -DskipTests -Djdk17 -Pjava17-target
130+
```
131+
132+
**For Java 21**
133+
134+
```
135+
./mvnw clean package -DskipTests -Djdk21 -Pjava21-target
136+
```
137+
138+
The build process will take approximately 10 minutes to complete.
139+
Flink will be installed in `build-target`.
140+
141+
### Notes
142+
143+
* Make sure your JAVA_HOME environment variable points to the correct JDK version
144+
* The build command uses Maven wrapper (mvnw) which ensures the correct Maven version is used
145+
* The -DskipTests flag skips running tests to speed up the build process
146+
* Each Java version requires its corresponding profile (-Pjava<version>-target) and JDK flag (-Djdk<version>)
116147

117148
## Developing Flink
118149

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ stages:
7676
vmImage: 'ubuntu-22.04'
7777
e2e_pool_definition:
7878
vmImage: 'ubuntu-22.04'
79-
environment: PROFILE="-Dflink.hadoop.version=2.10.2"
79+
environment: PROFILE="-Dflink.hadoop.version=2.10.2 -Djdk17 -Pjava17-target"
8080
run_end_to_end: false
8181
container: flink-build-container
82-
jdk: 11
82+
jdk: 17
8383
- job: docs_404_check # run on a MSFT provided machine
8484
pool:
8585
vmImage: 'ubuntu-22.04'

flink-dist-scala/src/main/resources/META-INF/NOTICE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This project bundles the following dependencies under the Apache Software Licens
1010

1111
The following dependencies all share the same BSD license which you find under licenses/LICENSE.scala.
1212

13-
- org.scala-lang:scala-compiler:2.12.7
14-
- org.scala-lang:scala-library:2.12.7
15-
- org.scala-lang:scala-reflect:2.12.7
16-
- org.scala-lang.modules:scala-xml_2.12:1.0.6
13+
- org.scala-lang:scala-compiler:2.12.20
14+
- org.scala-lang:scala-library:2.12.20
15+
- org.scala-lang:scala-reflect:2.12.20
16+
- org.scala-lang.modules:scala-xml_2.12:2.3.0

flink-end-to-end-tests/test-scripts/common_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ function build_image() {
4646
start_file_server
4747
local server_pid=$!
4848

49-
echo "Preparing Dockeriles"
49+
echo "Preparing Dockerfiles"
5050
retry_times_with_exponential_backoff 5 git clone https://github.com/apache/flink-docker.git --branch dev-master --single-branch
5151

52-
local java_version=11
52+
local java_version=17
5353
if [[ ${PROFILE} == *"jdk17"* ]]; then
5454
java_version=17
5555
fi

flink-rpc/flink-rpc-akka/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ under the License.
3838

3939
<properties>
4040
<pekko.version>1.1.2</pekko.version>
41-
<scala.binary.version>2.12</scala.binary.version>
42-
<scala.version>2.12.16</scala.version>
4341
</properties>
4442

4543
<dependencies>

flink-table/flink-table-planner-loader-bundle/src/main/resources/META-INF/NOTICE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ The Apache Software Foundation (http://www.apache.org/).
66

77
The following dependencies all share the same BSD license which you find under licenses/LICENSE.scala.
88

9-
- org.scala-lang:scala-compiler:2.12.7
10-
- org.scala-lang:scala-library:2.12.7
11-
- org.scala-lang:scala-reflect:2.12.7
9+
- org.scala-lang:scala-compiler:2.12.20
10+
- org.scala-lang:scala-library:2.12.20
11+
- org.scala-lang:scala-reflect:2.12.20

0 commit comments

Comments
 (0)