Reputation: 508
I am using the following to write a message producer:
My pom.xml file has this entry from http://kafka.apache.org/documentation.html#theproducer
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.8.2.0</version>
</dependency>
When I issued here is what my HelloWorld.java app looks like:
import kafka.javaapi.producer.Producer;
public class HelloWorld
{
public static void main(String args[])
{
int x = 4;
System.out.println("hello world");
}
}
I then compile using Maven.
mvn compile
But I get the following error.
[ERROR] /home/azureuser/test-application/src/main/java/HelloWorld.java:
[6,30] package kafka.javaapi.producer does not exist
Does anyone know what is missing?
Any help appreciated.
Upvotes: 2
Views: 2938
Reputation: 8161
I think the correct import should be org.apache.kafka.clients.producer
.
Check the packages
section at the bottom here
Upvotes: 1
Reputation: 1783
Look into your .m2 repository and find the jar (.m2/repository/org/apache/kafka/kafka-clients-0.8.2.0.jar) file, and you will see that the import should be:
import org.apache.kafka.clients.producer.Producer;
Upvotes: 1
Reputation: 97379
Based on my search on Maven Central it looks like your defined dependency is wrong.
Upvotes: 1