is there a way I can retrieve the annotationProces...
# community-support
g
is there a way I can retrieve the annotationProcessor path of the generated sources?
found
compileJava.options.generatedSourceOutputDirectory
šŸ‘Œ 1
Copy code
sourceSets.main.java {
    srcDir(compileJava.options.generatedSourceOutputDirectory.get())
}
this creates a circular dependency though
Circular dependency between the following tasks:
radio commonradio-common-json:compileJava
\--- radio commonradio-common-json:compileJava (*)
What's the proper way to solve this?
this seems to make it happy
Copy code
sourceSets.main.java {
    srcDir(compileJava.options.generatedSourceOutputDirectory.get())
}

sourcesJar.dependsOn(compileJava)
delombok.dependsOn(compileJava)
t
It's an output directory, not a source directory. If you want to add it as input to other tasks, then reconfigure those tasks (delombok should probably do that by default) And you'll probably want to use
sourceSets.main.output.generatedSourcesDirs
instead (at least for
sourcesJar
)
g
for some reasons, Idea cant find the generated source class, if I add it explicitly with
srcDir
then it's fine, but this introduce those further issues > delombok should probably do that by default it seems it hasnt, gradle warned me to fix that implicit dependency
t
Works like a charm for me, and it marks them as generated sources too.
g
the marking is there, but when I run
assemble
then I get
unresolved class
t
Looks like we're mixing things here, as there seems to be two issues. • IntelliJ IDEA should recognize the generated sources, and shouldn't mark errors in source files that use generated classes. If it doesn't work, it's an IDEA issue, and it could possibly be mitigated by configuring the
idea
plugin in the Gradle build (not by adding the generated sources as sources to the source set that will generate them šŸ” 🄚 ) • Gradle should have task wiring OK so that
./gradle assemble
"just works", unless some plugins are buggy (if you're using io.freefair.lombok, then the delombok should already be configured to take advantage of the generated sources, but won't delombok them as they shouldn't contain any lombok-isms: https://github.com/freefair/gradle-plugins/blob/cd47ebf3ed7a8741ebef5a780df8345ab3[…]c/main/java/io/freefair/gradle/plugins/lombok/LombokPlugin.java); then you can possibly re-configure some tasks, e.g. the
sourcesJar
to add those generated sources (e.g.
tasks.sourcesJar { from(sourceSets.main.output.generatedSourcesDirs) }
.
šŸ‘ 1