I'm currently using JavaCC (with the JavaCC gradle plugin from here) to generate some of my source code. The rest of the project does depend on that code. If I import the project into IDEA or clean the project, then I will get errors because classes are not found. However, building the project does work.
Is it possible to modify the gradle file, so that IntelliJ (and possibly other editors too) know to generate these sources before analysing the code?
The generated code is saved in src/gen/java/ and the location of the generated code is made known via:
sourceSets {
gen {
java {
srcDir 'src/gen/java'
}
}
}
Since IntelliJ is building the project I thought the easiest way would have been to do:
compileJava.dependsOn <generateSourcesTask>
But adding that to the gradle file does not have an effect (probably because the JavaCC plugin is doing this already).
gradle idea
you could make that have a dependency on the correct target – Coper