paul
paul

Reputation: 13471

Circular dependency between testCompiler tasks

I have three test folders for scala, groovy and Java.

In Java I have a class that has a dependency with Groovy and in Groovy I have a class that has a dependency with Scala.

So I add this dependency relationship in my gradle build file:

 compileTestGroovy.dependsOn compileTestScala
 compileTestJava.dependsOn compileTestGroovy

But I´m receiving this error on Gradle

   Circular dependency between the following tasks:
:compileTestGroovy
+--- :compileTestJava
|    \--- :compileTestGroovy (*)
\--- :compileTestScala
     \--- :compileTestJava (*)

(*) - details omitted (listed previously)

Any idea what I´m doing wrong?

Regards

Upvotes: 4

Views: 2096

Answers (1)

naimdjon
naimdjon

Reputation: 3602

You need to use the joint compilation which essentially means you need to put the sources together. From the docs:

[...]can deal with Groovy code, mixed Groovy and Java code, and even pure Java code (although we don’t necessarily recommend to use it for the latter). The plugin supports joint compilation, which allows you to freely mix and match Groovy and Java code, with dependencies in both directions. For example, a Groovy class can extend a Java class that in turn extends a Groovy class. This makes it possible to use the best language for the job, and to rewrite any class in the other language if needed.

Upvotes: 2

Related Questions