Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/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
在Groovy中解压缩文件时遇到问题_Groovy - Fatal编程技术网

在Groovy中解压缩文件时遇到问题

在Groovy中解压缩文件时遇到问题,groovy,Groovy,我正在尝试从Groovy中的压缩文件解压/解压缩文件。我正在使用shell命令解压(我尝试了几个使用在线找到的java.util.zip库解压的示例,但没有一个成功) 下面是使用shell命令的代码: def soutz = new StringBuilder(), serrz = new StringBuilder() def procz = "unzip -o consall.zip consolidated.xml".ex

我正在尝试从Groovy中的压缩文件解压/解压缩文件。我正在使用shell命令解压(我尝试了几个使用在线找到的java.util.zip库解压的示例,但没有一个成功) 下面是使用shell命令的代码:

            def soutz = new StringBuilder(), serrz = new StringBuilder()
            def procz = "unzip -o consall.zip consolidated.xml".execute()
            procz.consumeProcessOutput(soutz, serrz)
            procz.waitFor()
            sdc.log.info( "out> $soutz err> $serrz")
这是输出:

out> Archive: /resources/ofac_sdn/temp/consall.zip  
  inflating: consolidated.xml        
 err> 
但是提取的文件consolidated.xml实际上并没有具体化(无论是在进程运行时还是以后) 此外,waitFor()或waitForOrKill(5000)似乎不起作用,也没有任何区别。
感谢您的建议

使用ant builder解压

new AntBuilder().unzip(src: "consall.zip", dest: "./"){
    patternset{ 
        include(name: "**/consolidated.xml")
    } 
}

只是想确保流程有权限写入“/resources/ofac_sdn/temp/”?是否回答了您的问题?这是否回答了您的问题?