Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16357

Kafka Client JAR manifest breaks javac linting

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Duplicate
    • 3.7.0
    • None
    • clients
    • None
    • Linux, JDK 21 (Docker image eclipse-temurin:21-jdk-jammy)

    Description

      I upgraded kafka-clients from 3.6.1 to 3.7.0 and discovered that my project is not building anymore.

      The reason is that kafka-clients-3.7.0.jar contains the following entry in its JAR manifest file:

      Class-Path: zstd-jni-1.5.5-6.jar lz4-java-1.8.0.jar snappy-java-1.1.10
       .5.jar slf4j-api-1.7.36.jar

      I'm using Maven repo to keep my dependencies and those files are not in the same directory as kafka-clients-3.7.0.jar, so the paths in the manifest's Class-Path are not correct. It fails my build because we build with javac with all linting options on, in particular -Xlint:-path. It produces the following warnings coming from javac:
      [WARNING] COMPILATION WARNING :
      [INFO] -------------------------------------------------------------
      [WARNING] [path] bad path element "/home/ci/.m2/repository/org/apache/kafka/kafka-clients/3.7.0/zstd-jni-1.5.5-6.jar": no such file or directory
      [WARNING] [path] bad path element "/home/ci/.m2/repository/org/apache/kafka/kafka-clients/3.7.0/lz4-java-1.8.0.jar": no such file or directory
      [WARNING] [path] bad path element "/home/ci/.m2/repository/org/apache/kafka/kafka-clients/3.7.0/snappy-java-1.1.10.5.jar": no such file or directory
      [WARNING] [path] bad path element "/home/ci/.m2/repository/org/apache/kafka/kafka-clients/3.7.0/slf4j-api-1.7.36.jar": no such file or directory
      Since we have also -Werror option enabled, it turns warnings into errors and fails our build.

      I think our setup is quite typical: using Maven repo to store dependencies, having linting on and -Werror. Unfortunatelly, it doesn't work with the lastest kafka-clients because of the entries in the manifest's Class-Path. And I think it might affect quite a lot of projects set up in a similar way.

      I don't know what was the reason to add Class-Path entry in the JAR manifest file - but perhaps this effect was not considered.

      It would be great if you removed the Class-Path entry from the JAR manifest file.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              j.wojciechowski-rtbh Jacek Wojciechowski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: