Açıklaması şöyle
The Copy task is a task type provided by core Gradle. At execution, a copy task copies files into a destination directory from one or more sources, optionally transforming files as it copies. You tell the copy task where to get files, where to put them, and how to filter them through a configuration block.
from ve into Alanları
Örnek
Şöyle yaparız
task copyPoems(type: Copy) {from 'text-files'into 'build/poems'}
duplicatesStrategy Alanı
Açıklaması şöyle
EXCLUDEDo not allow duplicates by ignoring subsequent items to be created at the same path.FAILThrow a DuplicateFileCopyingException when subsequent items are to be created at the same path.INCLUDEDo not attempt to prevent duplicates.INHERITThe default strategy, which is to inherit the strategy from the parent copy spec, if any, or INCLUDE if the copy spec has no parent.WARNDo not attempt to prevent duplicates, but log a warning message when multiple items are to be created at the same path.
Açıklaması şöyle. Yani Gradle 7'den itibaren duplicatesStrategy açıkça atanmalı
If there is already rebel.xml present among the source files then the behavior will depend on Gradle version. Versions below 7.0 do not require any additional configuration and the generated rebel.xml will be included to the build result by default. Since Gradle 7.0, duplicatesStrategy must be configured in build.gradle in order to prevent a duplicate entry error at build time:...The value 'include' will force the generated rebel.xml to be copied to the build result. Contrariwise, 'exclude' will favor rebel.xml that is present among the source files.
Örnek
Şöyle yaparız
tasks.withType<Jar>() { duplicatesStrategy = DuplicatesStrategy.EXCLUDE manifest { attributes["Main-Class"] = "MainKt" } configurations["compileClasspath"].forEach { file: File -> from(zipTree(file.absoluteFile)) } }
Hiç yorum yok:
Yorum Gönder