下面是我的蚂蚁剧本。
<exec executable="zip" dir="/usr/local/clo/ven/image/manual_bundle/testzip/">
<arg value="-y"/>
<arg value="-r"/>
<arg value="${file.path}"/>
<arg value="*"/>
</exec>但以下的错误会发生。
zip-image_binary:
[exec] zip warning: name not matched: *
[exec]
[exec] zip error: Nothing to do! (try: zip -y -r /usr/local/clo/ven/image/a.zip . -i *)
[exec] Result: 12我的目的是压缩/usr/local/clo/ven/image/manual_bundle/testzip/下的所有文件和目录
发布于 2016-07-12 09:49:44
当您使用shell运行命令时,shell将展开* glob模式。zip可执行文件完全不需要任何模式,只需要一个文件列表(通常由shell提供)。如果不想使用内置的zip任务,可以通过使用apply而不是exec来模拟这种行为。就像这样
<apply executable="zip" parallel="true" relative="true"
dir="/usr/local/clo/ven/image/manual_bundle/testzip/">
<fileset dir="/usr/local/clo/ven/image/manual_bundle/testzip/"/>
<mergemapper to="${file.path}"/>
<arg value="-y"/>
<arg value="-r"/>
<targetfile/>
</apply>等价的zip任务简单得多
<zip destfile="${file.path}">
<fileset dir="/usr/local/clo/ven/image/manual_bundle/testzip/"/>
</zip>https://stackoverflow.com/questions/38319353
复制相似问题