7

I want to try kafka 0.8 (as I understand it is already released). But where can I find the kafka maven repository.

And what additional repository url should I add?

I've found some blogs with

 <dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.8.0</artifactId>
    <version>0.8.0-SHA</version>
 </dependency>

but it is not works. I'm looking for proper maven dependency. Or should I checkout it from git and deploy in our internal artifactory?

Julias
  • 5,752
  • 17
  • 59
  • 84
  • 2
    Maybe [this](http://grokbase.com/t/kafka/users/1356qq1fry/maven-integration-in-0-8) will help. – Andrew Logvinov Jun 11 '13 at 05:56
  • Especially this comment http://grokbase.com/t/kafka/users/1356qq1fry/maven-integration-in-0-8#20130507cbk3h24nhazgyyb85pmykcas48 – Adrian Jun 11 '13 at 06:44
  • Thanks, I can take kafka7 from conjars. But in general I probably got miss-understanding that kafka8 is released – Julias Jun 11 '13 at 11:23
  • The accepted answer provided by Cebence below is good not only because it provides an answer for this particular Kafka need but, in general, cleverly also answers the question of how to handle JAR dependencies that are needed, but which have not yet made it into the Maven repository. – NYCeyes Aug 10 '15 at 22:55

7 Answers7

7

UPDATE

Since November 2013 official Kafka releases can be found on public Maven repository, the latest version in March 2015 being 0.8.2.1:

<dependency>
  <groupId>org.apache.kafka</groupId>
  <artifactId>kafka_2.10</artifactId>
  <version>0.8.2.1</version>
</dependency>

If you created the not.released:kafka artifact detailed below any more you can remove it from the local repository.


Original Answer

Kafka is not released yet to a public Maven repository, but you can add it to your local Maven repository by hand with the install-file command:

mvn install:install-file -Dpackaging=jar -DgroupId=not.released
    -DartifactId=kafka -Dversion=0.8.0 -Dfile=kafka.jar

The command line above expects kafka.jar file in the current working directory. Once installed you can use it with:

<dependency>
  <groupId>not.released</groupId>
  <artifactId>kafka</artifactId>
  <version>0.8.0</version>
</dependency>

Once they release Kafka you can just change the dependency in your POMs and remove / uninstall this file from your local repository.

Community
  • 1
  • 1
Cebence
  • 2,406
  • 2
  • 19
  • 20
  • 2
    Kafka 0.8.0-beta1 is now available at maven.org. groupId is org.apache.kafka, artifactId is kafka_2.9.2 (2.9.2 is the scala version, others are available), version is 0.8.0-beta1. – Richard Aug 12 '13 at 15:28
  • Since Kafka is published one should use the official Maven dependency. My answer is a general way of making Maven dependency from a library that doesn't have Maven support, it will work on any JAR. – Cebence Oct 06 '13 at 11:26
6

As of December 2013, Kafka 0.8 Final was released and is available under the following definition:

<dependency>
  <groupId>org.apache.kafka</groupId>
  <artifactId>kafka_2.10</artifactId>
  <version>0.8.0</version>
</dependency>
fourk
  • 2,224
  • 1
  • 16
  • 10
3
    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.9.2</artifactId>
        <version>0.8.0-beta1</version>
    </dependency>
Hild
  • 2,625
  • 3
  • 22
  • 22
  • seems to be a bad pom.xml file, has two tags (should be one) – Nitzan Volman Sep 04 '13 at 09:06
  • can u be bit more specific? – Hild Sep 05 '13 at 14:11
  • 1
    sure, the pom.xml file is not a valid pom.xml according to: http://maven.apache.org/xsd/maven-4.0.0.xsd . the tag has maxOccurs="1" and in http://repo1.maven.org/maven2/org/apache/kafka/kafka_2.9.2/0.8.0-beta1/kafka_2.9.2-0.8.0-beta1.pom it appears twice with the configuration split between the two tags. they should be united into a single tag – Nitzan Volman Sep 07 '13 at 09:41
2

Even though this is already answered, I think future readers might benefit from a complete simple example that works out of the box. I put one together here > https://github.com/buildlackey/cep

Like the o.p., I have been fighting to find a Maven pom.xml recipe that will allow me to pull in an official version of Kafka from a public Maven repository. I did manage to get my example working, but for now I have had to hack my dependencies so that the version of Kafka I use is pulled from a work-in-progress version of a storm-kafka integration project. I'm concerned the 'wip' versions below will be deprecated. Then this project will lose its dependencies and fail to build properly. Also, I really shouldn't be introducing storm for this simple Kafka example at this point in any case.


   
        storm
        storm
        0.9.0-wip17
    
    
        storm
        storm-core
        0.9.0-wip17
    
    
        storm
        storm-kafka
        0.9.0-wip16a-scala292
    
    


If someone could provide me with a patch for 'the right way' to do this with Maven I will update my project accordingly.... Hopefully it will serve as a useful resource for other beginning Kafka developers.

Chris Bedford
  • 2,560
  • 3
  • 28
  • 60
1

Just go to http://mvnrepository.com/artifact/org.apache.kafka and choose from the list kafka repository matching to your version.

Vladimir Kroz
  • 5,237
  • 6
  • 39
  • 50
0

You can find all the realease version here:

http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.kafka%22

frank
  • 1,761
  • 2
  • 16
  • 20
-1

Here is another clue:

<dependency>
    <groupId>com.sksamuel.kafka</groupId>
    <artifactId>kafka_2.10</artifactId>
    <version>0.8.0-beta1</version>
</dependency>
Alvin
  • 12
  • 1