[ 
https://issues.apache.org/jira/browse/KAFKA-6474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16402326#comment-16402326
 ] 

Filipe Agapito commented on KAFKA-6474:
---------------------------------------

Hi John,
 I also ran into the cyclic dependency issue. For instance, running:
{code:java}
./gradlew streams:test --tests 
org.apache.kafka.streams.processor.TopologyBuilderTest
{code}
resulted in:
{code:java}
 Task :streams:compileTestJava FAILED
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Users/agapito/Development/apache/kafka/streams/src/test/java/org/apache/kafka/streams/kstream/internals/GlobalKTableJoinsTest.java:24:
 error: cannot find symbol
import org.apache.kafka.streams.TopologyTestDriver;
{code}
I added :streams:test-utilsĀ as a dependency to :streams in build gradle, which 
then led to:
{code:java}
FAILURE: Build failed with an exception.

* What went wrong:
Circular dependency between the following tasks:
:streams:copyDependantLibs
+--- :streams:jar
|    \--- :streams:copyDependantLibs (*)
\--- :streams:test-utils:jar
     +--- :streams:test-utils:classes
     |    \--- :streams:test-utils:compileJava
     |         \--- :streams:jar (*)
     \--- :streams:test-utils:copyDependantLibs
          \--- :streams:jar (*)

(*) - details omitted (listed previously)
{code}
I got rid of it by adding the following changes to build.gradle:
{code:java}
diff --git a/build.gradle b/build.gradle
index 5e4c35643..17b49258d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -921,6 +921,7 @@ project(':streams') {
     testCompile project(':clients').sourceSets.test.output
     testCompile project(':core')
     testCompile project(':core').sourceSets.test.output
+    testCompile project(':streams:test-utils').sourceSets.main.output
     testCompile libs.junit
     testCompile libs.easymock
     testCompile libs.bcpkix
@@ -965,7 +966,7 @@ project(':streams:test-utils') {
   archivesBaseName = "kafka-streams-test-utils"

   dependencies {
-    compile project(':streams')
+    compile project(':streams').sourceSets.main.output
     compile project(':clients')

     testCompile project(':clients').sourceSets.test.output
{code}
This way both the tests and the jar build run cleanly. I'm not sure if this is 
the best solution, but this issue entails a large refactor (not too complicated 
but there are a lot of test classes to change) so it at least allows me to 
continue refactoring and testing my changes without worrying about the cyclic 
dependency. I only figured it out today. Previously I was just running the 
tests in Intellij, where I added test-utils_main as a dependency of streams -> 
streams_test module, so it was all working fine there. I hope this helps.

> Rewrite test to use new public TopologyTestDriver
> -------------------------------------------------
>
>                 Key: KAFKA-6474
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6474
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams, unit tests
>    Affects Versions: 1.1.0
>            Reporter: Matthias J. Sax
>            Assignee: Filipe Agapito
>            Priority: Major
>              Labels: beginner, newbie
>
> With KIP-247 we added public TopologyTestDriver. We should rewrite out own 
> test to use this new test driver and remove the two classes 
> ProcessorTopoogyTestDriver and KStreamTestDriver.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to