0

Gradle multi-module project build fails with an unclear error. I run this command:

gradle :module:processor:integrationTest

(module:processor depends on module:processor-core, integrationTest is a custom Gradle task for running tests. I'm using kapt plugin as an annotation processor for Spring Boot configuration properties)

And I get this result:

> 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)

I don't understand why.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259

1 Answers1

1

it was fixed by adding the following code to the build.gradle of processor-core module:

jar {
    archiveBaseName = 'processor-core'
}

without these lines, I guess this step is disabled by Spring Boot, so the JAR file was not produced, and this led to the error.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
  • I see. That probably doesn't work for me. Here is my error ```Execution failed for task ':app:checkClassicGooglePlayDebugDuplicateClasses'. > Could not resolve all files for configuration ':app:classicGooglePlayDebugRuntimeClasspath'. > Failed to transform SaaS_TalkingDataSDK_Android_V5.0.0.jar to match attributes {artifactType=enumerated-runtime-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. > Execution failed for EnumerateClassesTransform: /home/circleci/project/app/libs/SaaS_TalkingDataSDK_Android_V5.0.0.jar. > zip END header not found``` – virengujariya Jan 21 '22 at 16:45
  • https://stackoverflow.com/questions/70804827/failed-to-transform-jar-to-match-attributes – virengujariya Jan 21 '22 at 16:53