Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

completed the first two steps of the setup described above (install, prepare Eclipse and checkout Kafka source).

Generate Eclipse project files

  • cd <kafka.project.dir>
  • 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

...

  • 
    

...

  • .

...

  • .

...

  • .

...

  • 
    
    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
    
    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")
    

...

  • ./sbt update

...

  • 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
    

...

Create the Eclipse workspace

  • Open Eclipse and create a new workspace;
  • Import the generated project (File ->

...

  • Import -> General -> Existing Projects into Workspace)

    ...

      1. Navigate to the

    ...

      1. <kafka.project.dir>. Eclipse will find the projects generated by the previous command

    ...

      1. ;

    ...

      1. Select the projects you want to import

    ...

      1. ;

    ...

    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. For running unit tests and Kafka broker refer to the previous section.

    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

    ...

    Install and prepare IntelliJ

    • Download and install IntelliJ;
    • Install the IntelliJ IDEA Scala Plugin (Preferences -> Plugins -> Browse Repositories -> Search for Scala);

    Checkout Kafka source

    ...

    • <kafka.project.dir>

    Update

    ...

    libraries and generate IntelliJ project files

    ...

    • cd <kafka.project.dir>
    • ./sbt update

    ...

    • ./sbt

    ...

    • idea

    ...

    Create IntelliJ workspace

    • Open Intellij and create new project pointing to <kafka.project.dir>