我有三个用于
scala,groovy和
Java的测试文件夹.
在Java中,我有一个与Groovy有依赖关系的类,在Groovy中我有一个与Scala有依赖关系的类.
所以我在gradle构建文件中添加了这个依赖关系:
compileTestGroovy.dependsOn compileTestScala
compileTestJava.dependsOn compileTestGroovy
但我在Gradle上收到此错误
Circular dependency between the following tasks:
:compileTestGroovy
+--- :compileTestJava
| \--- :compileTestGroovy (*)
\--- :compileTestScala
\--- :compileTestJava (*)
(*) - details omitted (listed previously)
知道我做错了吗?
问候
最佳答案 您需要使用
joint compilation,这实际上意味着您需要将源放在一起.来自文档:
[…]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.