Closed ZacSweers closed 3 months ago
This is actually a false positive warning in AGP. Will link an issue if they accept. In the meantime, the below works around it by removing KSP artifacts from their task that computes these
tasks.withType<JavaPreCompileTask>()
.configureEach {
doFirst {
// JavaPreCompileTask incorrectly reads annotation processors from the ksp classpath
// and then warns about them ending up in the JavaCompile tasks even though they're
// not on the classpath. This works around that by clearing out that field before it
// tries to merge them in with annotationProcessorArtifacts.
JavaPreCompileTask::class.java.getDeclaredField("kspProcessorArtifacts")
.apply { isAccessible = true }
.set(this, null)
}
}
Repro: https://github.com/zacsweers/catchup
I have no idea why this happens, as it's not visible in the dependencies task either 🤔