-
-
Notifications
You must be signed in to change notification settings - Fork 424
shadowJar fails with "Cannot expand ZIP" when dependency includes non-existent class directory #1975
Copy link
Copy link
Closed
Labels
Description
Expected and Results
When a project dependency includes a class output directory that does not exist (e.g., build/classes/java/api from a custom source set with no Java sources), shadowJar should gracefully skip it or treat it as an empty directory, rather than failing.
Actual behavior
shadowJar fails with:
Cannot expand ZIP '/path/to/project/build/classes/java/api' as it does not exist.
Related environment and versions
No response
Reproduction steps
- Create a multi-module Gradle project with a custom api source set:
// root build.gradle.kts
subprojects {
sourceSets {
val api by creating
val main by getting {
compileClasspath += api.output
runtimeClasspath += api.output
}
}
}
- In one of the submodules, apply the Shadow plugin and have Kotlin-only sources in the api source set (no Java files under src/api/java/).
- Run ./gradlew :module:shadowJar.
- The task fails because build/classes/java/api is included in runtimeClasspath via api.output, but the directory was never created since there are no Java sources to compile in that source set.
Anything else?
No response
Reactions are currently unavailable