I has a JarTask as:
task merge_a_b(type: Jar){
classifier = ‘a_b’
duplicatesStrategy = ‘exclude’
from zipTree(‘a.jar’)
from zipTree(‘b.jar’)
}
since a.jar and b.jar has same file as ‘com/xxx/common/util.class’ , the default jar task will copy two files (util.class) into my new jar file. As I read the gradle DSL Reference , I found jar has a property duplicatesStrategy which can be used to exclude duplicated files.
DuplicatesStrategy duplicatesStrategy The strategy to use when trying to copy more than one file to the same destination. The value can be set with a case insensitive string of the enum value (e.g. ‘exclude’ for DuplicatesStrategy.EXCLUDE). This strategy can be overridden for individual files by using CopySpec.eachFile() or CopySpec.filesMatching().
but when the property is set, gradle will warning me that "Deprecated dynamic property: “duplicatesStrategy” on “task '” which means the property does not exits!
my gradle version is 1.6.