Skip to content

Commit ede6c90

Browse files
authored
KAFKA-19664 Support building with Java 25 (LTS release) (#20561)
This patch updates the Apache Kafka project's build, test, and dependency configurations. - Java Version Update: The build and test processes have been upgraded from Java 24 to Java 25. - Scala Version Update: The Scala library version has been updated from 2.13.16 to 2.13.17. - Dependency Upgrades: Several dependencies have been updated to newer versions, including mockito (5.14.2 to 5.20.0), zinc (1.10.8 to 1.11.0), and scala-library/reflect (2.13.16 to 2.13.17). - Code and Configuration Changes: The patch modifies build.gradle to exclude certain Spotbugs tasks for Java 25 compatibility. It also changes the default signing algorithm in TestSslUtils.java from SHA1withRSA to SHA256withRSA, enhancing security. - Documentation: The README.md file has been updated to reflect the new Java 25 requirement. Reviewers: Ismael Juma <[email protected]>, Liam Clarke-Hutchinson <[email protected]>, Gaurav Narula <[email protected]>, Chia-Ping Tsai <[email protected]>
1 parent 8a1c619 commit ede6c90

File tree

10 files changed

+26
-19
lines changed

10 files changed

+26
-19
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
- name: Setup Gradle
128128
uses: ./.github/actions/setup-gradle
129129
with:
130-
java-version: 24
130+
java-version: 17
131131
gradle-cache-read-only: ${{ !inputs.is-trunk }}
132132
gradle-cache-write-only: ${{ inputs.is-trunk }}
133133
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
@@ -181,7 +181,7 @@ jobs:
181181
fail-fast: false
182182
matrix:
183183
# If we change these, make sure to adjust ci-complete.yml
184-
java: [ 24, 17 ]
184+
java: [ 25, 17 ]
185185
run-flaky: [ true, false ]
186186
run-new: [ true, false ]
187187
exclude:
@@ -270,7 +270,7 @@ jobs:
270270
python .github/scripts/junit.py \
271271
--path build/junit-xml >> $GITHUB_STEP_SUMMARY
272272
273-
# This job downloads all the JUnit XML files and thread dumps from the JDK 24 test runs.
273+
# This job downloads all the JUnit XML files and thread dumps from the JDK 25 test runs.
274274
# If any test job fails, we will not run this job. Also, if any thread dump artifacts
275275
# are present, this means there was a timeout in the tests and so we will not proceed
276276
# with catalog creation.
@@ -288,7 +288,7 @@ jobs:
288288
- name: Download Thread Dumps
289289
uses: actions/download-artifact@v5
290290
with:
291-
pattern: junit-thread-dumps-24-*
291+
pattern: junit-thread-dumps-25-*
292292
path: thread-dumps
293293
merge-multiple: true
294294
- name: Check For Thread Dump
@@ -302,7 +302,7 @@ jobs:
302302
- name: Download JUnit XMLs
303303
uses: actions/download-artifact@v5
304304
with:
305-
pattern: junit-xml-24-* # Only look at JDK 24 tests for the test catalog
305+
pattern: junit-xml-25-* # Only look at JDK 25 tests for the test catalog
306306
path: junit-xml
307307
merge-multiple: true
308308
- name: Collate Test Catalog

.github/workflows/ci-complete.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
strategy:
4444
fail-fast: false
4545
matrix:
46-
# Make sure these match build.yml
47-
java: [ 24, 17 ]
46+
# Make sure these match build.yml and also keep in mind that GitHub Actions build will always use this file from the trunk branch.
47+
java: [ 25, 17 ]
4848
run-flaky: [ true, false ]
4949
run-new: [ true, false ]
5050
exclude:

LICENSE-binary

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ License Version 2.0:
248248
- opentelemetry-proto-1.3.2-alpha
249249
- plexus-utils-3.5.1
250250
- rocksdbjni-10.1.3
251-
- scala-library-2.13.16
251+
- scala-library-2.13.17
252252
- scala-logging_2.13-3.9.5
253-
- scala-reflect-2.13.16
253+
- scala-reflect-2.13.17
254254
- snappy-java-1.1.10.7
255255
- snakeyaml-2.4
256256
- swagger-annotations-2.2.25

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
You need to have [Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html) installed.
1515

16-
We build and test Apache Kafka with 17 and 24. The `release` parameter in javac is set to `11` for the clients
16+
We build and test Apache Kafka with 17 and 25. The `release` parameter in javac is set to `11` for the clients
1717
and streams modules, and `17` for the rest, ensuring compatibility with their respective
1818
minimum Java versions. Similarly, the `release` parameter in scalac is set to `11` for the streams modules and `17`
1919
for the rest.

bin/kafka-run-class.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ should_include_file() {
4949
base_dir=$(dirname $0)/..
5050

5151
if [ -z "$SCALA_VERSION" ]; then
52-
SCALA_VERSION=2.13.16
52+
SCALA_VERSION=2.13.17
5353
if [[ -f "$base_dir/gradle.properties" ]]; then
5454
SCALA_VERSION=`grep "^scalaVersion=" "$base_dir/gradle.properties" | cut -d= -f 2`
5555
fi

bin/windows/kafka-run-class.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ set BASE_DIR=%CD%
2727
popd
2828

2929
IF ["%SCALA_VERSION%"] EQU [""] (
30-
set SCALA_VERSION=2.13.16
30+
set SCALA_VERSION=2.13.17
3131
)
3232

3333
IF ["%SCALA_BINARY_VERSION%"] EQU [""] (

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ ext {
7171
"--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED"
7272
)
7373

74+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_25)) {
75+
// Spotbugs is not compatible with Java 25+ so Gradle related tasks are disabled
76+
// until version can be upgraded: https://github.com/spotbugs/spotbugs/issues/3564
77+
project.gradle.startParameter.excludedTaskNames.add("spotbugsMain")
78+
project.gradle.startParameter.excludedTaskNames.add("spotbugsTest")
79+
}
80+
7481
maxTestForks = project.hasProperty('maxParallelForks') ? maxParallelForks.toInteger() : Runtime.runtime.availableProcessors()
7582
maxScalacThreads = project.hasProperty('maxScalacThreads') ? maxScalacThreads.toInteger() :
7683
Math.min(Runtime.runtime.availableProcessors(), 8)

clients/src/test/java/org/apache/kafka/test/TestSslUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class TestSslUtils {
110110
* @param dn the X.509 Distinguished Name, eg "CN=Test, L=London, C=GB"
111111
* @param pair the KeyPair
112112
* @param days how many days from now the Certificate is valid for, or - for negative values - how many days before now
113-
* @param algorithm the signing algorithm, eg "SHA1withRSA"
113+
* @param algorithm the signing algorithm, eg "SHA256withRSA"
114114
* @return the self-signed certificate
115115
* @throws CertificateException thrown if a security error or an IO error occurred.
116116
*/
@@ -131,7 +131,7 @@ public static X509Certificate generateCertificate(String dn, KeyPair pair,
131131
* CA.
132132
* @param parentKeyPair The key pair of the issuer. Leave null if you want to generate a root
133133
* CA.
134-
* @param algorithm the signing algorithm, eg "SHA1withRSA"
134+
* @param algorithm the signing algorithm, eg "SHA256withRSA"
135135
* @return the signed certificate
136136
* @throws CertificateException
137137
*/
@@ -399,7 +399,7 @@ public static class CertificateBuilder {
399399
private byte[] subjectAltName;
400400

401401
public CertificateBuilder() {
402-
this(30, "SHA1withRSA");
402+
this(30, "SHA256withRSA");
403403
}
404404

405405
public CertificateBuilder(int days, String algorithm) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ group=org.apache.kafka
2424
# - streams/quickstart/java/src/main/resources/archetype-resources/pom.xml
2525
# - streams/quickstart/java/pom.xml
2626
version=4.2.0-SNAPSHOT
27-
scalaVersion=2.13.16
27+
scalaVersion=2.13.17
2828
# Adding swaggerVersion in gradle.properties to have a single version in place for swagger
2929
swaggerVersion=2.2.25
3030
task=build

gradle/dependencies.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ext {
2323
}
2424

2525
// Add Scala version
26-
def defaultScala213Version = '2.13.16'
26+
def defaultScala213Version = '2.13.17'
2727
if (hasProperty('scalaVersion')) {
2828
if (scalaVersion == '2.13') {
2929
versions["scala"] = defaultScala213Version
@@ -110,7 +110,7 @@ versions += [
110110
lz4: "1.8.0",
111111
mavenArtifact: "3.9.6",
112112
metrics: "2.2.0",
113-
mockito: "5.14.2",
113+
mockito: "5.20.0",
114114
opentelemetryProto: "1.3.2-alpha",
115115
protobuf: "3.25.5", // a dependency of opentelemetryProto
116116
pcollections: "4.0.2",
@@ -125,7 +125,7 @@ versions += [
125125
snappy: "1.1.10.7",
126126
spotbugs: "4.9.4",
127127
mockOAuth2Server: "2.2.1",
128-
zinc: "1.10.8",
128+
zinc: "1.11.0",
129129
// When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json
130130
// Also make sure the compression levels in org.apache.kafka.common.record.CompressionType are still valid
131131
zstd: "1.5.6-10",

0 commit comments

Comments
 (0)