Skip to content

Conversation

@dejan2609
Copy link
Contributor

@dejan2609 dejan2609 commented Nov 12, 2025

Prologue:
#19513 (comment)

💡 Rationale: Gradle 10 will be released in Q4 2026 or Q1 2027
and we can't expect that Shadow plugin version 8 will be compatible:

image

Release notes for Shadow plugin:


I did some testing, and results look just fine ✅:

  • gradle builds ./gradlew :jmh-benchmarks:shadowJar and ./gradlew releaseTarGz are successful
  • generated distributions (kafka_2.13-4.3.0-SNAPSHOT-site-docs.tgz and
    and kafka_2.13-4.3.0-SNAPSHOT.tgz) have identical file numbers (for
    trunk and this branch)
  • Kafka cluster starts and messages can be produced and consumed:
    https://kafka.apache.org/quickstart

⚠️ disclaimer notes:

  • solution is generated via Gemini CLI
  • Gemini prompt is based on Jira ticket (previously created by me):
    KAFKA-19761

@github-actions github-actions bot added triage PRs from the community build Gradle build or GitHub Actions small Small PRs labels Nov 12, 2025
@dejan2609
Copy link
Contributor Author

@chia7712 Please review when you have some time.

@github-actions github-actions bot removed the triage PRs from the community label Nov 13, 2025
@dejan2609 dejan2609 force-pushed the KAFKA-19761 branch 2 times, most recently from e96bddd to 1292e30 Compare November 20, 2025 11:08
@dejan2609
Copy link
Contributor Author

I'll rebase this onto trunk (to include a new, updated Gradle version into this branch/PR).

@dejan2609 dejan2609 force-pushed the KAFKA-19761 branch 2 times, most recently from fcaf575 to fbb1dc5 Compare November 30, 2025 21:38
@dejan2609 dejan2609 changed the title KAFKA-19761 Gradle Shadow plugin version upgrade: 8.3.9 -->> 9.2.2 KAFKA-19761 Gradle Shadow plugin version upgrade: 8.3.9 -->> 9.3.0 Dec 6, 2025
@dejan2609
Copy link
Contributor Author

Hi @apoorvmittal10,

Can you please allocate some time to provide a review ?

@dejan2609
Copy link
Contributor Author

Few tests are flaky/failing:
image

@dejan2609
Copy link
Contributor Author

dejan2609 commented Dec 13, 2025

Gradle task that ends up with one failed test works as expected on my machine:

dejan@dejan-HP-ProBook-450-G7:~/kafka$ date
Sat 13 Dec 16:21:53 CET 2025
dejan@dejan-HP-ProBook-450-G7:~/kafka$ java -version 
openjdk version "17.0.17" 2025-10-21
OpenJDK Runtime Environment Temurin-17.0.17+10 (build 17.0.17+10)
OpenJDK 64-Bit Server VM Temurin-17.0.17+10 (build 17.0.17+10, mixed mode, sharing)
dejan@dejan-HP-ProBook-450-G7:~/kafka$ ./gradlew :streams:upgrade-system-tests-24:test -q
Starting build with version 4.3.0-SNAPSHOT (commit id 4196380b) using Gradle 9.2.1, Java 17 and Scala 2.13.18
Build properties: ignoreFailures=false, maxParallelForks=8, maxScalacThreads=8, maxTestRetries=0
dejan@dejan-HP-ProBook-450-G7:~/kafka$ date
Sat 13 Dec 16:22:18 CET 2025
dejan@dejan-HP-ProBook-450-G7:~/kafka$

💡 I will try to execute entire test suite on Github Action CI server once more.

@dejan2609
Copy link
Contributor Author

All tests are fine now ✅

@chia7712 can you allocate some time to review this one ?

@dejan2609 dejan2609 changed the title KAFKA-19761 Gradle Shadow plugin version upgrade: 8.3.9 -->> 9.3.0 KAFKA-19761 Gradle Shadow plugin version upgrade: 8.3.9 -->> 9.3.1 Jan 8, 2026
@clolov
Copy link
Contributor

clolov commented Jan 9, 2026

Thanks for the change and apologies for the delay!

It may be because my expertise in Gradle is not my strong suit, but I would encourage you to give a brief overview of why all the changes in the PR are required!

The real problem is that if we just bump Gradle Shadow from 8 to 9 we run into

* What went wrong:
Execution failed for task ':jmh-benchmarks:shadowJar'.
> Cannot expand ZIP '/Users/REDACTED/Documents/kafka/core/build/classes/java/test' as it does not exist.

which appears to be because :core only has build/classes/scala while all other dependencies have build/classes/java and Gradle Shadow 9 appears to be more strict in requiring that directory to exist.

I am a bit on the fence for this change. On one hand, I don't like depending on .sourceSets.test.output in some places in the build.gradle file and on configurations/artifacts in others. On the other hand, I also don't like generating an empty folder (i.e. build/classes/java) just to satisfy a stricter expectation.

What are the opinions of others in the community?

@dejan2609
Copy link
Contributor Author

Hi @clolov and thanks for a review/comment ! You are rasing some valid questions here.

But first: can you please share your environment details (thing is that Gradle build task :jmh-benchmarks:shadowJar works just fine on my end):

dejan@box:~/kafka$ date
Fri  9 Jan 16:24:51 CET 2026
dejan@box:~/kafka$ uname -r
6.8.0-90-generic
dejan@box:~/kafka$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.3 LTS
Release:	24.04
Codename:	noble
dejan@box:~/kafka$ java -version 
openjdk version "25.0.1" 2025-10-21 LTS
OpenJDK Runtime Environment Temurin-25.0.1+8 (build 25.0.1+8-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.1+8 (build 25.0.1+8-LTS, mixed mode, sharing)
dejan@box:~/kafka$ git log -2 --oneline 
70dac31e9f (HEAD -> KAFKA-19761, origin/KAFKA-19761) KAFKA-19761 Gradle Shadow plugin version upgrade: 8.3.9 -->> 9.3.1
2f90af70ee (upstream/trunk, upstream/HEAD, origin/trunk, origin/HEAD, trunk) MINOR: Remove onPartitionsDeleted from GroupCoordinator interface (#21263)
dejan@box:~/kafka$ ./gradlew clean :jmh-benchmarks:shadowJar -q
Starting build with version 4.3.0-SNAPSHOT (commit id 70dac31e) using Gradle 9.2.1, Java 25 and Scala 2.13.18
Build properties: ignoreFailures=false, maxParallelForks=8, maxScalacThreads=8, maxTestRetries=0
MessageGenerator: processed 1 Kafka message JSON file(s).
MessageGenerator: processed 1 Kafka message JSON file(s).
MessageGenerator: processed 5 Kafka message JSON file(s).
MessageGenerator: processed 4 Kafka message JSON file(s).
MessageGenerator: processed 2 Kafka message JSON file(s).
MessageGenerator: processed 26 Kafka message JSON file(s).
MessageGenerator: processed 44 Kafka message JSON file(s).
MessageGenerator: processed 197 Kafka message JSON file(s).
MessageGenerator: processed 5 Kafka message JSON file(s).
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::arrayBaseOffset has been called by net.openhft.hashing.UnsafeAccess (file:/home/dejan/.gradle/caches/modules-2/files-2.1/net.openhft/zero-allocation-hashing/0.16/ca252f328160ed5d027f100a4fe525d6d21daaf/zero-allocation-hashing-0.16.jar)
WARNING: Please consider reporting this to the maintainers of class net.openhft.hashing.UnsafeAccess
WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dejan/kafka/coordinator-common/src/test/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/dejan/kafka/group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/StreamsGroupTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
dejan@box:~/kafka$ sdk use java 17.0.17-tem

Using java version 17.0.17-tem in this shell.
dejan@box:~/kafka$ java -version
openjdk version "17.0.17" 2025-10-21
OpenJDK Runtime Environment Temurin-17.0.17+10 (build 17.0.17+10)
OpenJDK 64-Bit Server VM Temurin-17.0.17+10 (build 17.0.17+10, mixed mode, sharing)
dejan@box:~/kafka$ ./gradlew clean :jmh-benchmarks:shadowJar -q
Starting build with version 4.3.0-SNAPSHOT (commit id 70dac31e) using Gradle 9.2.1, Java 17 and Scala 2.13.18
Build properties: ignoreFailures=false, maxParallelForks=8, maxScalacThreads=8, maxTestRetries=0
MessageGenerator: processed 4 Kafka message JSON file(s).
MessageGenerator: processed 1 Kafka message JSON file(s).
MessageGenerator: processed 5 Kafka message JSON file(s).
MessageGenerator: processed 2 Kafka message JSON file(s).
MessageGenerator: processed 1 Kafka message JSON file(s).
MessageGenerator: processed 26 Kafka message JSON file(s).
MessageGenerator: processed 44 Kafka message JSON file(s).
MessageGenerator: processed 197 Kafka message JSON file(s).
MessageGenerator: processed 5 Kafka message JSON file(s).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/dejan/kafka/coordinator-common/src/test/java/org/apache/kafka/coordinator/common/runtime/CoordinatorRuntimeTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/dejan/kafka/group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/StreamsGroupTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
dejan@box:~/kafka$ date
Fri  9 Jan 16:38:25 CET 2026
dejan@box:~/kafka$ 

@dejan2609
Copy link
Contributor Author

I am a bit on the fence for this change. On one hand, I don't like depending on .sourceSets.test.output in some places in the build.gradle file and on configurations/artifacts in others. On the other hand, I also don't like generating an empty folder (i.e. build/classes/java) just to satisfy a stricter expectation.

I can relate with all of this @clolov. Thing is that Kafka Gradle build is complicated due to a fact that people want Kafka to perform various complicated things.

And on top of that: dependencies versions just have to move forward: sooner or later this Shadow gradle plugin version will have to be bumped, one way or another.

All-in-all, we can either choose to:

  1. put some duct tape and/or WD-40 and call it a day (like here, in this PR 🙂)
  2. re-factor Gradle build (and remove some technical debt all along) - ⚠️ pitfall - it can be tricky
  3. something else 🤓

Open invitation to entire community: what is your take on this ?

@dejan2609
Copy link
Contributor Author

It may be because my expertise in Gradle is not my strong suit, but I would encourage you to give a brief overview of why all the changes in the PR are required!

Rationale section is added into description above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions ci-approved small Small PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants