Slackbot
12/22/2022, 9:36 AMThomas Broyer
12/22/2022, 11:44 AMcompileClasspath
should resolve the api
variant, but annotationProcessor
should resolve the runtime
variant. If that's not the case, then it's a bug in Gradle.Vampire
12/22/2022, 12:03 PMjvmPluginServices.configureAsRuntimeClasspath(annotationProcessorConfiguration);
I'd say an MCVE would be helpful.tomas-mrkvicka
12/22/2022, 1:39 PMproject-a
is defined within implementation configuration in project-b
even though it should be within api (because of project-a's classes are used with public visibility within project-b)? I know, it's a bug on our side.Vampire
12/22/2022, 1:47 PMapi
if you use its types in the public API like method parameters, return types, superclasses, ...
If you just use the classes in private methods or method bodies, implementation
is the right choice.
As annotationProcessor
should be pulling in the runtime classpath, it should also get the implementation
dependencies. So if b
has implementation
dependency on a
and you only add b
to annotationProcessor
of c
, then the classes of a
should automatically be present even without an explicit dependency on a
from `c`'s annotationProcessor
.tomas-mrkvicka
12/22/2022, 1:51 PMVampire
12/22/2022, 2:00 PM14:58:41: Executing 'classes'...
> Task :project-a:compileJava
> Task :project-a:processResources NO-SOURCE
> Task :project-a:classes
> Task :project-a:jar
> Task :project-b:compileJava
> Task :project-c:compileJava
> Task :project-c:processResources NO-SOURCE
> Task :project-c:classes
BUILD SUCCESSFUL in 25s
4 actionable tasks: 4 executed
14:59:12: Execution finished 'classes'.
Vampire
12/22/2022, 2:00 PM-all
by the good -bin
🙂tomas-mrkvicka
12/22/2022, 2:06 PMVampire
12/22/2022, 2:26 PM-all
is helpful in exactly one situation.
If you use Groovy DSL build scripts and only while editing the build scripts.
In all other cases, it is just a waste of time, bandwidth, and disk space for everyone and everything just executing the buildVampire
12/22/2022, 2:28 PMtomas-mrkvicka
12/22/2022, 2:44 PMThomas Broyer
12/22/2022, 2:45 PMannotationProcessor
then? In the MCVE, annotationProcessor
only includes :project-a
, not :project-b
-that-has-a-dependency-on-:project-a
. This looks more like something to do with either the spring-boot-configuration-processor
and/or JDK annotation processing, and would likely work the same with Gradle out of the equation.
Caused by: java.lang.IllegalStateException: Error processing configuration meta-data on foo.bar.c.Bla
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processElement(ConfigurationMetadataAnnotationProcessor.java:218)
at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.process(ConfigurationMetadataAnnotationProcessor.java:172)
Vampire
12/22/2022, 2:46 PMVampire
12/22/2022, 2:47 PMA
as annotation processor dependency and B
as api
dependency which then misses A
for compilation.
If you add A
as compile dependency in C
where it is missing, it also works with Java 8tomas-mrkvicka
12/22/2022, 7:57 PMA
, B
and C
🙂 Can you be more specific please?Thomas Broyer
12/22/2022, 8:42 PMYou are correct. I fixed the dependency within the MCVE.Changes nothing to the problem: likely a bug in the JDK and nothing to do with Gradle; in the MCVE I don't even understand why the projects are added to the
annotationProcessor
.tomas-mrkvicka
12/22/2022, 9:21 PMproject-a
to api
(instead of implementation
), it works fine. So I tried to add the dependency directly to the project-c
's annotationProcessor
.Vampire
12/22/2022, 10:24 PMannotationProcessor
class path, but on the compile class path.
So if you add it to `project-c`'s api
or implementation
it works even with Java 8tomas-mrkvicka
12/23/2022, 8:43 AM