Issue
- A module contains
proto
files emits the following error when it’s compiled withline-gradle-scripts
grpc preset.$ ./gradlew clean :protocol:build Type-safe dependency accessors is an incubating feature. > Task :protocol:sourcesJar FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':protocol:sourcesJar'. > Entry com/example/foo/FooOuterClass.java is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.4/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.
Cause
- Files under
gen-src/main/java
gets registered twice assourceSet
once byline-gradle-scripts
at java.gradle:L58 and again byprotobuf-gradle-plugin
.
Workaround
- Comment out java.gradle:L58
- Define
Jar
task duplicatesStrategy as follows:tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.INCLUDE }