Make Jar build fail on duplicate files
This commit is contained in:
parent
b4b99d991c
commit
bf0651e88b
|
@ -30,6 +30,23 @@ if (configurations.find { it.name == 'jmh' }) {
|
|||
eclipse.classpath.plusConfigurations += [configurations.jmh]
|
||||
}
|
||||
|
||||
jar {
|
||||
/*
|
||||
Make Jar build fail on duplicate files
|
||||
|
||||
By default Gradle Jar task can put multiple files with the same name
|
||||
into a Jar. This may lead to confusion. For example if auto-service
|
||||
annotation processing creates files with same name in `scala` and
|
||||
`java` directory this would result in Jar having two files with the
|
||||
same name in it. Which in turn would result in only one of those
|
||||
files being actually considered when that Jar is used leading to very
|
||||
confusing failures.
|
||||
|
||||
Instead we should 'fail early' and avoid building such Jars.
|
||||
*/
|
||||
duplicatesStrategy = 'fail'
|
||||
}
|
||||
|
||||
task packageSources(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
|
|
Loading…
Reference in New Issue