Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler error on kafka-emitter #13029

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

didip
Copy link
Contributor

@didip didip commented Sep 5, 2022

Description

Fix compiler error on IDE:

The project was not built since its build path is incomplete. Cannot find the class file for org.slf4j.Logger. Fix the build path then try building this project

Key changed/added classes in this PR
  • KafkaEmitter.java

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

… incomplete. Cannot find the class file for org.slf4j.Logger. Fix the build path then try building this project
@didip didip changed the title Fix compiler error: The project was not built since its build path is… Fix compiler error on kafka-emitter Sep 5, 2022
@FrankChen021
Copy link
Member

Kafka emitter does not directly use API in slf4j. Which IDE are you using? Intellij? If it is, usually 'Reload All Maven Projects' button on the Maven panel solves compliation problem on IDE.

@FrankChen021 FrankChen021 added the Area - Dev For items related to the project itself, like dev docs and checklists, but not CI label Sep 6, 2022
@didip
Copy link
Contributor Author

didip commented Sep 6, 2022

@FrankChen021 I am seeing this error on VSCode.

@dampcake
Copy link
Contributor

dampcake commented Sep 6, 2022

I have worked around this by using the solution posted at the end of redhat-developer/vscode-java#2569 but maybe we should add the directive to the pom?

@FrankChen021
Copy link
Member

@dampcake Thanks for the link. Seems it's a problem at the vs code side.

I'm wondering if this problem is only on Kafka emitter extension?

@didip
Copy link
Contributor Author

didip commented Sep 6, 2022

Yes, it is indeed only on kafka-emitter extension.

@didip
Copy link
Contributor Author

didip commented Sep 6, 2022

Without adding that dependency, this is marked as broken:

public class KafkaEmitter implements Emitter
{
  private static Logger log = new Logger(KafkaEmitter.class);
  ...
}

with the following message:

The type org.slf4j.Logger cannot be resolved. It is indirectly referenced from required .class files

@dampcake
Copy link
Contributor

dampcake commented Sep 6, 2022

It should affect any IDE that uses m2e; VSCode and Eclipse, possibly others. Would also extend to stuff based on those like GitHub Codespaces.

@FrankChen021
Copy link
Member

FrankChen021 commented Sep 6, 2022

But if we look at other extensions, such as graphite emitter, it has the same code,

public class GraphiteEmitter implements Emitter
{
  private static Logger log = new Logger(GraphiteEmitter.class);

And this extension does not explictly include slf4j dependency. Why doesn't it have similar compliation error? This is weired.

@FrankChen021
Copy link
Member

image

From the dependency-analyzer, these two extensions differ from each other on the slf4j-api dependency.

I think the problem might be due to kafka-client module which declares the scope of slf4j-api as runtime.

@abhishekagarwal87 abhishekagarwal87 merged commit 66545a0 into apache:master Sep 6, 2022
@kfaraz kfaraz added this to the 25.0 milestone Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - Dev For items related to the project itself, like dev docs and checklists, but not CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants