Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Make build pass on JDK11 #610

Merged
merged 3 commits into from
Jul 15, 2021
Merged

Conversation

eolivelli
Copy link
Contributor

This patch allows you to build KOP on JDK11.

Without this patch the build fails with this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project kafka-client-factory: Compilation failure: Compilation failure: 
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[33,20] cannot access org.apache.kafka-1-0-0.clients.producer.KafkaProducer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.producer.KafkaProducer not found
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[41,20] cannot access org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer not found
[ERROR] -> [Help 1]
[ERROR] 

Modifications
do not use '-' in the package name

As I do not have signed an ICLA with this repo, I would like to state explicitly that I am sending this patch according to the terms Apache License v2.

@BewareMyPower
Copy link
Collaborator

Thanks for your contribution. It makes sense to me.

But I have a concern that some version number may have two digits like Kafka 0.10.0.0. If we supported these versions in future, what's the best way to name the package? kafka01000?

@BewareMyPower BewareMyPower added the type/enhancement Indicates an improvement to an existing feature label Jul 10, 2021
Copy link
Collaborator

@BewareMyPower BewareMyPower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BewareMyPower
Copy link
Collaborator

The getStringSerializer and getStringDeserializer should also be modified, for example,

    public String getStringSerializer() {
        /* ... */
        return String.format("org.apache.kafka-%s.common.serialization.StringSerializer", name);
    }

should be modified to

    public String getStringSerializer() {
        /* ... */
        return String.format("org.apache.kafka%s.common.serialization.StringSerializer", name);
    }

It also applies to getStringDeserializer() because they will use the relocated class path to load classes of different Kafka versions.

@BewareMyPower
Copy link
Collaborator

Hi @eolivelli , could you apply my comments to fix the broken tests?

@eolivelli
Copy link
Contributor Author

sure @BewareMyPower
doing it now

@BewareMyPower BewareMyPower merged commit 0d44b57 into streamnative:master Jul 15, 2021
@eolivelli eolivelli deleted the fix/jdk11 branch July 15, 2021 12:54
@eolivelli
Copy link
Contributor Author

thank you !

BewareMyPower pushed a commit to BewareMyPower/kop that referenced this pull request Jul 25, 2021
This patch allows you to build KOP on JDK11.

Without this patch the build fails with this error:

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project kafka-client-factory: Compilation failure: Compilation failure: 
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[33,20] cannot access org.apache.kafka-1-0-0.clients.producer.KafkaProducer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.producer.KafkaProducer not found
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[41,20] cannot access org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer not found
[ERROR] -> [Help 1]
[ERROR] 
```

**Modifications**
do not use '-' in the package name


As I do not have signed an ICLA with this repo, I would like to state explicitly that I am sending this patch according to the terms Apache License v2.
BewareMyPower pushed a commit that referenced this pull request Jul 25, 2021
This patch allows you to build KOP on JDK11.

Without this patch the build fails with this error:

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project kafka-client-factory: Compilation failure: Compilation failure: 
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[33,20] cannot access org.apache.kafka-1-0-0.clients.producer.KafkaProducer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.producer.KafkaProducer not found
[ERROR] /Users/enrico.olivelli/dev/kop/kafka-client-factory/src/main/java/io/streamnative/kafka/client/api/KafkaClientFactoryImpl.java:[41,20] cannot access org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer
[ERROR]   class file for org.apache.kafka-1-0-0.clients.consumer.KafkaConsumer not found
[ERROR] -> [Help 1]
[ERROR] 
```

**Modifications**
do not use '-' in the package name


As I do not have signed an ICLA with this repo, I would like to state explicitly that I am sending this patch according to the terms Apache License v2.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement Indicates an improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants