Generating sources with annotation processor

I contributed a benchmark for my config library to a Java Benchmark of configuration libraries:

My library uses an annotation processor to generate some Java files. I have added that to the build.gradle file:

dependencies {
    annotationProcessor 'de.poiu.coat:coat-processor:1.0.0'
    implementation 'de.poiu.coat:coat-runtime:1.0.0'
}

But no code is generated. I suspect it has to do with how the project is structured (There is a build.gradle file for the whole project and each config library that is being benchmarked gets another one with no more content than those dependencies.

Unfortunately I don’t know anything about gradle and am unable to find out why the annotation processor is not used.
It should generate the ConfigParam and ImmutableConfig files that are included in the PR I linked above.

The main build.gradle can be found here: java-config-library-benchmarks/build.gradle at main · hupfdule/java-config-library-benchmarks · GitHub

Any help would be much appreciated.

As your sources are in the jmh source set, it would be cleaner to declare the coat-runtime for jmhImplementation, not implementation.
Nevertheless, this works as jmhCompileClasspath and jmhRuntimeClasspath are configured to also extend from implementation.

But for annotation processors something similar is not done.
So declare the processor for jmhAnnotationProcessor and it works like intended.

Many thanks! That did indeed help!

1 Like