无法解析由“StructureTransformAction”执行失败导致的配置“_classStructurekaptKotlin”的所有文件

Could not resolve all files for configuration `_classStructurekaptKotlin` caused by Execution failed for `StructureTransformAction`

Gradle 多模块项目构建失败,错误不明。我 运行 这个命令:

gradle :module:processor:integrationTest

(module:processor 取决于 module:processor-coreintegrationTest 是 运行ning 测试的自定义 Gradle 任务。我使用 kapt 插件作为 Spring 引导配置属性的注释处理器)

我得到了这个结果:

> Task :module:processor-core:kaptGenerateStubsKotlin UP-TO-DATE
> Task :module:processor-core:kaptKotlin UP-TO-DATE
...
> Task :module:processor-core:jar SKIPPED
> Task :module:processor:kaptGenerateStubsKotlin
> Task :module:processor:kaptKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':module:processor:kaptKotlin'.
> Could not resolve all files for configuration ':module:processor:_classStructurekaptKotlin'.
   > Failed to transform processor-core-SNAPSHOT.jar to match attributes {artifactType=class-structure, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for StructureTransformAction: D:\dev\backend-project\module\processor-core\build\libs\processor-core-SNAPSHOT.jar.
         > D:\dev\backend-project\module\processor-core\build\libs\processor-core-SNAPSHOT.jar (The system cannot find the path specified)

我不明白为什么。

已通过将以下代码添加到 processor-core 模块的 build.gradle 来解决此问题:

jar {
    archiveBaseName = 'processor-core'
}

如果没有这些行,我猜这一步被 Spring 引导禁用了,所以没有生成 JAR 文件,这导致了错误。