I'm trying to create a Kafka Streams application with Java and having a hard time managing the dependencies. Please let me say that I am completely noob to Java and it's ecosystem of tools.
The project is compiled with Maven and I'm using IntelliJ Idea. The project is configured to use OpenJDK 14.
Here's the pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.petite</groupId>
<artifactId>ora</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>14</source>
<target>14</target>
</configuration>
</plugin>
</plugins>
<defaultGoal>compile</defaultGoal>
</build>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
</project>
With this setup I can print a "Hello world!" to the console but as soon as I import Kafka Streams classes errors start to pop up:
package com.petite;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.kstream.StreamsBuilder;
import org.apache.kafka.streams.processor.Topology;
public class Main {
public static void main(String[] args) {
System.out.println("Hello from Java");
}
}
IntelliJ tells me that it can't find the symbols StreamsBuilder and Topology. Now being a complete alien to Java, IntelliJ and Maven I really can't find a way to go forward.
How come the dependencies shown on Kafka site (https://kafka.apache.org/25/documentation/streams/developer-guide/write-streams.html#libraries-and-maven-artifacts) can be downloaded but can't be imported?