title: java.lang.NoClassDefFoundError: org/apache/kafka/clients/producer/Producer
body: <p>I'm trying to use Kafka:</p>
  
  <pre><code>import java.util.Properties;
  import org.apache.kafka.clients.producer.Producer;
  import org.apache.kafka.clients.producer.KafkaProducer;
  import org.apache.kafka.clients.producer.ProducerRecord;
  
  public class SimpleProducer {
      public static void main(String[] args) {
          Properties props = new Properties();
          Producer&lt;String, String&gt; producer = new KafkaProducer&lt;String, String&gt;(props);
      }
  }
  </code></pre>
  
  <p>But getting the following error:</p>
  
  <blockquote>
    <p>java.lang.NoClassDefFoundError:
    org/apache/kafka/clients/producer/Producer</p>
  </blockquote>
  
  <p>build.gradle:</p>
  
  <pre><code>...
  
  dependencies {
      testCompile group: 'junit', name: 'junit', version: '4.12'
      compile group: 'org.apache.kafka', name: 'kafka-clients', version: '2.2.0'
  }
  
  ...
  </code></pre>