Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Gradle无法压缩.gitignore和.gitattributes_Java_Ant_Groovy_Gradle_Zip - Fatal编程技术网

Java Gradle无法压缩.gitignore和.gitattributes

Java Gradle无法压缩.gitignore和.gitattributes,java,ant,groovy,gradle,zip,Java,Ant,Groovy,Gradle,Zip,我正在尝试压缩.gittributes和.gitignore但无论我如何尝试,它们仍然不存在于压缩包中 task packageZip(type:Zip) { from('.') { include '**/**' include '**/.gitattributes' exclude 'build' } } 我知道默认情况下排除了这两个文件,但我不知道如何将defaultExclude设置为false。但它失败了 我不

我正在尝试压缩
.gittributes
.gitignore
但无论我如何尝试,它们仍然不存在于压缩包中

task packageZip(type:Zip) {  
    from('.') {  
      include '**/**'  
      include '**/.gitattributes'  
      exclude 'build'  
   }  
}
我知道默认情况下排除了这两个文件,但我不知道如何将defaultExclude设置为
false
。但它失败了

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

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

这不容易找到,但最后我有一个解决方案给你

您可以直接在Ant中使用defaultexcludes(Zip任务或AbstractCopyTask,扩展后的任务似乎没有实现这一点。如果实现了,请纠正我)。但是蚂蚁会。因此,请遵循:

ant.zip(destfile: 'archive.zip') {
  fileset(dir: 'dir', defaultexcludes:"no")
}
要想把它变成一项任务,就去做吧

task packageZip << {
  // ant.zip ....
}
任务包zip