GeezerVison is showing github.com — Assembling source jar (`sourcesJar` Gradle task) on generated library fails due to duplicate source directory entries · Issue #893 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Assembling source jar (sourcesJar Gradle task) on generated library fails due to duplicate source directory entries #893
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. Description
b/211697397
> Task :grpc-google-cloud-retail-v2alpha-java:sourcesJar FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':grpc-google-cloud-retail-v2alpha-java:sourcesJar'.
> Entry com/google/cloud/retail/v2alpha/CompletionServiceGrpc.java is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.3.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.
Starting with Gradle 7, copying files fail when there are duplicate entries. Some relevant details are here. However, unlike the workarounds suggested there, we should fix the root cause.
In our case, the cause is the following configuration
sourceSets {
main {
java {
srcDir 'src/main/java'
}
}
}
where srcDir adds the directory to the main source set. The default value of main.srcDirs is [ 'src/main/java' ], so calling srcDir 'src/main/java' results in [ 'src/main/java', 'src.main/java' ] (duplicates).
Activity
added
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2Moderately-important priority. Fix may not be included in next release. on Jan 7, 2022
Metadata
Metadata
priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. Development
No branches or pull requestsIssue actions