From e4675339b96a5f0adfe0d81bb6c8238bdc7022bb Mon Sep 17 00:00:00 2001 From: Ismael Juma Date: Tue, 18 Mar 2025 15:33:48 -0700 Subject: [PATCH 1/2] MINOR: Run CI with Java 24 and update documentation (instead of 23) --- .github/workflows/build.yml | 10 +++++----- .github/workflows/ci-complete.yml | 2 +- README.md | 2 +- docs/documentation/compatibility.html | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc5ee1bd7558b..5137f8bf37292 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,7 +127,7 @@ jobs: - name: Setup Gradle uses: ./.github/actions/setup-gradle with: - java-version: 23 + java-version: 24 gradle-cache-read-only: ${{ !inputs.is-trunk }} gradle-cache-write-only: ${{ inputs.is-trunk }} develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} @@ -181,7 +181,7 @@ jobs: fail-fast: false matrix: # If we change these, make sure to adjust ci-complete.yml - java: [ 23, 17 ] + java: [ 24, 17 ] run-flaky: [ true, false ] run-new: [ true, false ] exclude: @@ -270,7 +270,7 @@ jobs: python .github/scripts/junit.py \ --path build/junit-xml >> $GITHUB_STEP_SUMMARY - # This job downloads all the JUnit XML files and thread dumps from the JDK 23 test runs. + # This job downloads all the JUnit XML files and thread dumps from the JDK 24 test runs. # If any test job fails, we will not run this job. Also, if any thread dump artifacts # are present, this means there was a timeout in the tests and so we will not proceed # with catalog creation. @@ -288,7 +288,7 @@ jobs: - name: Download Thread Dumps uses: actions/download-artifact@v4 with: - pattern: junit-thread-dumps-23-* + pattern: junit-thread-dumps-24-* path: thread-dumps merge-multiple: true - name: Check For Thread Dump @@ -302,7 +302,7 @@ jobs: - name: Download JUnit XMLs uses: actions/download-artifact@v4 with: - pattern: junit-xml-23-* # Only look at JDK 23 tests for the test catalog + pattern: junit-xml-24-* # Only look at JDK 24 tests for the test catalog path: junit-xml merge-multiple: true - name: Collate Test Catalog diff --git a/.github/workflows/ci-complete.yml b/.github/workflows/ci-complete.yml index 8855c998df28b..44d4f5a9c1d62 100644 --- a/.github/workflows/ci-complete.yml +++ b/.github/workflows/ci-complete.yml @@ -44,7 +44,7 @@ jobs: fail-fast: false matrix: # Make sure these match build.yml - java: [ 23, 17 ] + java: [ 24, 17 ] run-flaky: [ true, false ] run-new: [ true, false ] exclude: diff --git a/README.md b/README.md index 4c2fc4e1f160b..8b5fe4c332ed2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You need to have [Java](http://www.oracle.com/technetwork/java/javase/downloads/index.html) installed. -We build and test Apache Kafka with 17 and 23. The `release` parameter in javac is set to `11` for the clients +We build and test Apache Kafka with 17 and 24. The `release` parameter in javac is set to `11` for the clients and streams modules, and `17` for the rest, ensuring compatibility with their respective minimum Java versions. Similarly, the `release` parameter in scalac is set to `11` for the streams modules and `17` for the rest. diff --git a/docs/documentation/compatibility.html b/docs/documentation/compatibility.html index e1b5134ea40fa..d191a8bbecb94 100644 --- a/docs/documentation/compatibility.html +++ b/docs/documentation/compatibility.html @@ -30,7 +30,7 @@

JDK Compatibility Across Kafka Versions

Kafka Version Java 11 Java 17 - Java 23 + Java 24 Clients @@ -198,4 +198,4 @@

Client/Broker Forward Compatibility

- \ No newline at end of file + From a82ddcbf955fd3d9656a1dae71fdb46c5f7f988d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Rohde=20D=C3=B8ssing?= Date: Fri, 28 Mar 2025 18:35:56 +0100 Subject: [PATCH 2/2] MINOR: Change to allow building on Java 24 Upgrade Scala to 2.13.16, in order to get a Java 24-compatible ASM version. Upgrade Gradle to 8.14, which is the first Java 24 compatible version. Upgrade spotbugs to 4.9.4. This is the minimum version that's both Java 24 compatible, and not affected by https://github.com/spotbugs/spotbugs/issues/3320 Since the new spotbugs version introduces some extra checks, this commit excludes those warnings, without looking at whether they are real issues or false positives. Fix gradle wrapper. The download-the-wrapper bit was inserted before the CLASSPATH line in the wrapper, because that referenced the jar. That line no longer mentions the jar, because the wrapper is referenced via -jar instead of -cp now. This means the download was placed in the middle of a java invocation command, breaking the script. It's been moved to be before the call to exec. It seems fair to assume that the script will only exec once, and that the exec call is going to call the wrapper. --- LICENSE-binary | 4 +- bin/kafka-run-class.sh | 2 +- bin/windows/kafka-run-class.bat | 2 +- build.gradle | 3 +- gradle.properties | 2 +- gradle/dependencies.gradle | 4 +- gradle/spotbugs-exclude.xml | 149 ++++++++++++++++++++++++++++++++ gradlew | 38 ++++---- wrapper.gradle | 4 +- 9 files changed, 180 insertions(+), 28 deletions(-) diff --git a/LICENSE-binary b/LICENSE-binary index 09e226835e655..e813f434a3a56 100644 --- a/LICENSE-binary +++ b/LICENSE-binary @@ -247,9 +247,9 @@ License Version 2.0: - opentelemetry-proto-1.0.0-alpha - plexus-utils-3.5.1 - rocksdbjni-9.7.3 -- scala-library-2.13.15 +- scala-library-2.13.16 - scala-logging_2.13-3.9.5 -- scala-reflect-2.13.15 +- scala-reflect-2.13.16 - snappy-java-1.1.10.5 - snakeyaml-2.2 - swagger-annotations-2.2.25 diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index 3463389d3c005..90b6e4e4c28bf 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -49,7 +49,7 @@ should_include_file() { base_dir=$(dirname $0)/.. if [ -z "$SCALA_VERSION" ]; then - SCALA_VERSION=2.13.15 + SCALA_VERSION=2.13.16 if [[ -f "$base_dir/gradle.properties" ]]; then SCALA_VERSION=`grep "^scalaVersion=" "$base_dir/gradle.properties" | cut -d= -f 2` fi diff --git a/bin/windows/kafka-run-class.bat b/bin/windows/kafka-run-class.bat index ca151e5df96ed..9994d501700eb 100755 --- a/bin/windows/kafka-run-class.bat +++ b/bin/windows/kafka-run-class.bat @@ -27,7 +27,7 @@ set BASE_DIR=%CD% popd IF ["%SCALA_VERSION%"] EQU [""] ( - set SCALA_VERSION=2.13.15 + set SCALA_VERSION=2.13.16 ) IF ["%SCALA_BINARY_VERSION%"] EQU [""] ( diff --git a/build.gradle b/build.gradle index 36ced29d0bd61..12abb4c48e2d4 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ plugins { id 'org.nosphere.apache.rat' version "0.8.1" id "io.swagger.core.v3.swagger-gradle-plugin" version "${swaggerVersion}" - id "com.github.spotbugs" version '6.0.25' apply false + id "com.github.spotbugs" version '6.1.7' apply false id 'org.scoverage' version '8.0.3' apply false id 'com.gradleup.shadow' version '8.3.6' apply false id 'com.diffplug.spotless' version "6.25.0" @@ -163,6 +163,7 @@ ext { allprojects { repositories { + mavenLocal() mavenCentral() } diff --git a/gradle.properties b/gradle.properties index 46bfc41b7e1aa..52bf115819de5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ group=org.apache.kafka # - streams/quickstart/java/src/main/resources/archetype-resources/pom.xml # - streams/quickstart/java/pom.xml version=4.1.0-SNAPSHOT -scalaVersion=2.13.15 +scalaVersion=2.13.16 # Adding swaggerVersion in gradle.properties to have a single version in place for swagger swaggerVersion=2.2.25 task=build diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 23df24bc479be..733ae3c0d5d4c 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -23,7 +23,7 @@ ext { } // Add Scala version -def defaultScala213Version = '2.13.15' +def defaultScala213Version = '2.13.16' if (hasProperty('scalaVersion')) { if (scalaVersion == '2.13') { versions["scala"] = defaultScala213Version @@ -121,7 +121,7 @@ versions += [ scoverage: "2.0.11", slf4j: "1.7.36", snappy: "1.1.10.5", - spotbugs: "4.8.6", + spotbugs: "4.9.4-SNAPSHOT", zinc: "1.9.2", // When updating the zstd version, please do as well in docker/native/native-image-configs/resource-config.json // Also make sure the compression levels in org.apache.kafka.common.record.CompressionType are still valid diff --git a/gradle/spotbugs-exclude.xml b/gradle/spotbugs-exclude.xml index 080681e8db376..1419d8f3fa72a 100644 --- a/gradle/spotbugs-exclude.xml +++ b/gradle/spotbugs-exclude.xml @@ -550,4 +550,153 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gradlew b/gradlew index b377d46f9e967..8a2c0a948b419 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,20 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac - -# Loop in case we encounter an error. -for attempt in 1 2 3; do - if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then - if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v8.14.0/gradle/wrapper/gradle-wrapper.jar"; then - rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" - # Pause for a bit before looping in case the server throttled us. - sleep 5 - continue - fi - fi -done - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -216,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -224,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. @@ -259,4 +248,17 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' + +# Loop in case we encounter an error. +for attempt in 1 2 3; do + if [ ! -e "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" ]; then + if ! curl -s -S --retry 3 -L -o "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" "https://raw.githubusercontent.com/gradle/gradle/v8.14.0/gradle/wrapper/gradle-wrapper.jar"; then + rm -f "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" + # Pause for a bit before looping in case the server throttled us. + sleep 5 + continue + fi + fi +done + exec "$JAVACMD" "$@" diff --git a/wrapper.gradle b/wrapper.gradle index 2dfca19e74f71..ffc35ee2f28f5 100644 --- a/wrapper.gradle +++ b/wrapper.gradle @@ -65,8 +65,8 @@ task bootstrapWrapper() { wrapperScript.withPrintWriter { out -> def bootstrapWritten = false wrapperLines.each { line -> - // Print the wrapper bootstrap before the first usage of the wrapper jar. - if (!bootstrapWritten && line.contains("gradle-wrapper.jar")) { + // Print the wrapper bootstrap before the script execs the wrapper jar. + if (!bootstrapWritten && line.startsWith("exec ")) { out.println(bootstrapString) bootstrapWritten = true }