Zip files/Directories in Groovy with AntBuilder

后端 未结 1 1857
故里飘歌
故里飘歌 2021-01-07 07:39

I am trying to zip files and directories in Groovy using AntBuilder. I have the following code:

def ant = new AntBuilder()
ant.zip(basedir: \"./Testing\", de         


        
相关标签:
1条回答
  • 2021-01-07 08:14

    If you look at the docs for the ant zip task, the includes parameter is described as:

    comma- or space-separated list of patterns of files that must be included

    So you're right, that it is the space separator that's breaking it...

    You need to use the longer route to get this to work:

    new AntBuilder().zip( destFile: "${file}.zip" ) {
      fileset( dir: './Testing' ) {
        include( name:file.name )
      }
    }
    
    0 讨论(0)
提交回复
热议问题