Reputation: 67
In Eclipse I've added the kafka-clients-jms.jar
to the build path of my project.
I get no errors in Eclipse, but when I run mvn clean install
it fails, because it can't find the KafkaJmsConnectionFactory
class which is part of the .jar that I've added to the build path.
Not sure how to fix this issue. Any ideas?
Upvotes: 4
Views: 2394
Reputation: 6577
Manually adding a library to Eclipse's build path does not automatically add it to the POM file.
Judging from the missing class, it looks like you are trying to use a library hosted on GitHub in a Maven project: https://github.com/adispennette/apache-kafka-jms
Since GitHub is not a Maven repository, you will need to manually install the artifact to your local repository first.
$ mvn install:install-file -Dfile=kafka-clients-jms.jar -DgroupId=org.apache.kafka -DartifactId=kafka-clients-jms -Dversion=0.8.2.2-SNAPSHOT -Dpackaging=jar
and then add the following to the POM file:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients-jms</artifactId>
<version>0.8.2.2-SNAPSHOT</version>
</dependency>
Upvotes: 1
Reputation: 4014
When you manually add the jar to the build path in Eclipse, it's only added to the dependencies in Eclipse, but not the classpath when you run maven from command line. Add the jar to the dependencies
in your pom.xml.
It's probably advisable to always maintain your dependencies in pom.xml, and use maven's eclipse plugin (or Eclipse's Maven plugin) to keep it in sync with your Eclipse project settings.
Upvotes: 0