I have a JavaExec task which runs a Java class to generate files. The source code generator needs to search CLASSPATH to find certain classes it uses to determine what to generate. It needs the current project's classes to be in CLASSPATH.
I have this task:
task showClasspath(type: JavaExec) {
main = "com.my.codegen.Main"
classpath = sourceSets.main.runtimeClasspath
classpath += project(":CodeGen").sourceSets.main.runtimeClasspath
args "generate",
}
When I run this task I get "Circular dependency between the following tasks:". So obviously I'm referring classpath back to itself.
If I use this task then the project classes are not in CLASSPATH:
task showClasspath(type: JavaExec) {
main = "com.my.codegen.Main"
classpath += project(":CodeGen").sourceSets.main.runtimeClasspath
args "generate",
}
I've been going around in circles for hours on this and could really use some help.
Thanks in advance!