[KYUUBI #5314] Support JDK 21

# 🔍 Description
## Issue References 🔗
This pull request fixes #5314

## Describe Your Solution 🔧
To support Java 21, some dependency packages need to be upgraded.Here is the detailed explanation.
1. To build with Java 21, Scala binary version needs to be upgraded to 2.13.11 or above.
2. The versions of `spotless` and `googlejavaformat` need to be upgraded to higher versions. However, this will lose support for Java 8. In order to continue supporting Java 8, code style checks will be ignored in the Java 21 profile.
3. Since the Flink engine does not support Scala 2.13, the Scala version of the Flink module is fixed at 2.12.

Previous discussions were at https://github.com/apache/kyuubi/pull/6306.

---
## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

---

**Be nice. Be informative.**

Closes #6597 from dupen01/issue-java21.

Closes #5314

0c5a9e455 [Cheng Pan] simplify
54cbadf79 [dupeng] java21+scala2.13.11+flink_2.12+CI(spark4,21,2,13)

Lead-authored-by: dupeng <dunett@163.com>
Co-authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
dupeng 2024-08-23 14:56:30 +08:00 committed by Cheng Pan
parent d5c31a85a4
commit 074a412f81
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D
2 changed files with 23 additions and 2 deletions

View File

@ -55,7 +55,7 @@ jobs:
exclude-tags: [""]
comment: ["normal"]
include:
- java: 17
- java: 21
spark: '4.0'
spark-archive: '-Pscala-2.13'
exclude-tags: ''

23
pom.xml
View File

@ -236,6 +236,7 @@
<maven.plugin.scalatest.exclude.tags>org.scalatest.tags.Slow</maven.plugin.scalatest.exclude.tags>
<maven.plugin.scalatest.include.tags></maven.plugin.scalatest.include.tags>
<maven.plugin.scalatest.debug.enabled>false</maven.plugin.scalatest.debug.enabled>
<!-- TODO: Once we drop support for Java 8, we can consider upgrade spotless.version to 2.43.0. -->
<maven.plugin.spotless.version>2.30.0</maven.plugin.spotless.version>
<maven.plugin.surefire.version>3.2.1</maven.plugin.surefire.version>
<maven.plugin.jacoco.version>0.8.11</maven.plugin.jacoco.version>
@ -255,7 +256,8 @@
<!-- Package to use when relocating shaded classes. -->
<kyuubi.shade.packageName>org.apache.kyuubi.shade</kyuubi.shade.packageName>
<!-- Needed for Spotless style check-->
<!-- Needed for Spotless style check.
TODO: Once we drop support for Java 8, we can consider upgrade googlejavaformat.version to 1.22.0 or above. -->
<spotless.java.googlejavaformat.version>1.7</spotless.java.googlejavaformat.version>
<spotless.python.includes></spotless.python.includes>
<spotless.python.black.version>22.3.0</spotless.python.black.version>
@ -1927,6 +1929,25 @@
</properties>
</profile>
<profile>
<id>java-21</id>
<activation>
<jdk>21</jdk>
</activation>
<properties>
<java.version>21</java.version>
<maven.compiler.source></maven.compiler.source>
<maven.compiler.target></maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<!-- TODO: The current version of spotless(2.30.0) and google-java-format(1.7)
does not support Java 21, but new version produces different outputs.
Re-evaluate once we dropped support for Java 8. -->
<maven.plugin.spotless.version>2.43.0</maven.plugin.spotless.version>
<spotless.check.skip>true</spotless.check.skip>
<spotless.java.googlejavaformat.version>1.22.0</spotless.java.googlejavaformat.version>
</properties>
</profile>
<profile>
<id>scala-2.12</id>
<properties>