Hi,
I have a tool written in Java which generates some source code required for compilation of my Project module.
The Java Tool can be called using static main method. I have written a gradle task to invoke it:
task generateStubSource(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'org.test.mytool.Generate'
args = [arg1]
standardOutput = System.out
errorOutput = System.err
}
I have added a dependency like this:
compileJava.dependsOn(generateStubSource)
But this somehow ends up in circular dependency.
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter]
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] Circular dependency between the following tasks:
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] :classes
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] ±-- :compileGroovy
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] | -– :compileJava
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] | -– :generateStubSource
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] | -– :classes ()
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] -– :compileJava ()
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter]
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] (*) - details omitted (listed previously)
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter]
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter]
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
00:57:15.782 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
00:57:15.782 [LIFECYCLE] [org.gradle.BuildResultLogger]
00:57:15.782 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
P.S. I am very new to gradle/groovy (just started couple of days back). Apologies if I have overlooked something very obvious.