https://kotlinlang.org logo
Title
n

Norbi

07/11/2022, 7:26 PM
I use KSP in a multi-platform multi-module project with Idea CE. (But currently KSP is applied only on one JVM project.) The processor implementation is in a separate project (
project-processor
), and it depends on another local project (
project-annotations
) containing the annotation class triggering my processor to be applied. When I try to build or clean the whole project, I often run into that the JAR file of
project-annotations
is locked and therefore cannot be deleted. After I stop all Gradle daemons using
gradlew --stop
and retry the build/clean then it always succeeds. So it seems that the build artifact of
project-annotations
is locked by a Gradle daemon(s) which executed my processor from
project-processor
- and not only during the build but for longer term. (I use Kotlin 1.7.10 and the latest compatible KSP plugin.)
Unable to delete directory '...\project-annotations\build'
  Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
  - ...\project-annotations\build\libs\project-annotations-jvm-1.0.0-SNAPSHOT.jar
  - ...\project-annotations\build\libs
Haven't you run into a similar problem?
e

ephemient

07/11/2022, 7:45 PM
I expect this is only an issue on Windows, as neither macos nor Linux default to exclusive file access
n

Norbi

07/11/2022, 8:02 PM
Yes! Sorry, I haven't mentioned that I use Windows 11.