-
Notifications
You must be signed in to change notification settings - Fork 173
Description
Problem
When running a test that creates module canvases via Documenter
the Javadoc is not visible because the annotation processor from spring-modulith-apt
runs for our test sources as well which overrides the javadoc.json
.
We are using Kotlin and our test sources are located in src/test/kotlin
. Because we are also using Gradle, the APT is configured with Kapt:
kapt("org.springframework.modulith:spring-modulith-apt:1.4.3")
When running the test, the SpringModulithProcessor
is executed via Gradle's kaptKotlin
and afterwards by kaptTestKotlin
. Both extract Javadoc into build/generated-spring-modulith/javadoc.json
whereas the second task effectively overwrites the javadoc.json
from the first run.
Solution
As far as I see the SpringModulithProcessor
should not run for test executions at all. The problem seems to be simply BuildSystemUtils.getTestTarget()
which checks the Java path build/classes/java/test
but not build/classes/kotlin/test
.
Workaround
With enabled Gradle caching, I can first execute the gradle kaptKotlin
task, followed by the gradle test
task. This prevents the kaptTestKotlin
task from running and ensures that the javadoc.json
file remains unchanged. The Javadoc is then included in the canvas documentation.