gpt4 book ai didi

java - Gradle 无法压缩 .gitignore 和 .gitattributes

转载 作者:行者123 更新时间:2023-11-29 05:21:09 24 4
gpt4 key购买 nike

我正在尝试压缩 .gitattributes.gitignore 但无论我如何尝试它们仍然不存在于 zip 中。

task packageZip(type:Zip) {  
from('.') {
include '**/**'
include '**/.gitattributes'
exclude 'build'
}
}

我知道默认排除这 2 个文件,但我不知道如何将 defaultExclude 设置为 false。但它失败了。

我不想更改默认排除的 gradle 设置,因为它可能会影响其他任务。你能给我一个 sample 吗?

task packageZip(type:Zip) {  
from "./"
defaultExclude = "false"
}

最佳答案

这并不容易找到,但我终于为您提供了一个解决方案。

您只能直接在 Ant 中使用 defaultexcludes(Zip 任务或 AbstractCopyTask whis extends 似乎没有实现它。如果它实现了 - 请纠正我)。但 Ant 有。因此:

ant.zip(destfile: 'archive.zip') {
fileset(dir: 'dir', defaultexcludes:"no")
}

要将其放入任务中,只需使用

task packageZip << {
// ant.zip ....
}

希望对您有所帮助。

关于java - Gradle 无法压缩 .gitignore 和 .gitattributes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24691975/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com