Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added info for sbteclipse plugin integration

...

    1. Run as...<Unit Test|Scala Application>
    2. By default log4j will not be configured correctly. To fix this go to your run target and under Classpath choose Advanced... and then Add Folders, and the folder config/

Eclipse Setup With SBT Eclipse Plugin

The following steps assume you have the kafka source and installed the Eclipse Scala IDE, as stated in the Eclipse Setup section above.

  1. edit the project/plugins.sbt file by adding the sbteclipse-plugin from Typesafe (last line in the snippet below). Once modified, the file should look like this:
    Code Block
    
    resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
    
    addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.8.5")
    
    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
    
    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")
    
  2. run: ./sbt update
  3. generate the eclipse projects with: ./sbt eclipse. This command will create eclipse projects for every project defined in Kafka. You should have the following output on your console:
    Code Block
    
    [info] About to create Eclipse project files for your project(s).
    [info] Successfully created Eclipse project files for project(s):
    [info] kafka-perf
    [info] hadoop-consumer
    [info] kafka-java-examples
    [info] kafka
    [info] hadoop-producer
    
  4. In eclipse, use Import -> General -> Existing Projects into Workspace
    1. navigate to the kafka source directory, it should find the projects generated by the previous command.
    2. select the projects you want to import and click Finish
    3. you should see the projects you have imported

Once you have your projects in place, you will be able to run/debug any of the applications from eclipse.

Info

You will need regenerate the projects and refresh eclipse every time there is a change in the projects dependencies. In other words, every time you run ./sbt update, you need to run ./sbt eclipse and refresh eclipse.

Intellij Setup

  1. Checkout kafka source
    1. svn co http://svn.apache.org/repos/asf/incubator/kafka/trunk kafka
  2. Update the libraries:
    1. ./sbt update
  3. Create IDEA project files:
    1. ./sbt
    2. idea
  4. Install the IntelliJ IDEA Scala Plugin Preferences -> Plugins -> Browse Repositories -> Search for Scala
  5. Open Itellij, Open new project, point to your kafka source location.