将 7z 合并到 ANT 的宏定义中
我一直在使用宏定义将一组文件复制到不同的位置和 FTP 服务器。但复制似乎很慢,所以我想使用 7z 压缩该包并将所有内容作为一个文件复制到 FTP 中。用7z可以实现吗?我的 amcrodef 工作如下:
<macrodef name="copyimages">
<attribute name="todir"/>
<sequential>
<copy todir="@{todir}" overwrite="true" failonerror="false">
<fileset dir="${build.output.dir}">
<include name="logs/*${build.id}*armv5*scan2.html"/>
<include name="logs/*${build.id}*main.ant.log"/>
<include name="logs/*${build.id}*bom.xml"/>
<include name="logs/compile/*${build.id}*.*"/>
<include name="logs/cone/*${build.id}*.*"/>
<include name="logs/post/*${build.id}*.*"/>
<include name="logs/roms/*${build.id}*.*"/>
<include name="**/*${build.id}_codescanner/**"/>
</fileset>
</copy>
</sequential>
</macrodef>
<copyimages todir="${publish.ssdoci.dir}/${env.version}.${build.number}"/>
I have been using a macro definition to copy a set of files to different locations and FTP servers. But copying seems quite slow so I want to compress the bundle using 7z and copy all into FTP as one single file. Can it be done using 7z? My amcrodef is below which works:
<macrodef name="copyimages">
<attribute name="todir"/>
<sequential>
<copy todir="@{todir}" overwrite="true" failonerror="false">
<fileset dir="${build.output.dir}">
<include name="logs/*${build.id}*armv5*scan2.html"/>
<include name="logs/*${build.id}*main.ant.log"/>
<include name="logs/*${build.id}*bom.xml"/>
<include name="logs/compile/*${build.id}*.*"/>
<include name="logs/cone/*${build.id}*.*"/>
<include name="logs/post/*${build.id}*.*"/>
<include name="logs/roms/*${build.id}*.*"/>
<include name="**/*${build.id}_codescanner/**"/>
</fileset>
</copy>
</sequential>
</macrodef>
<copyimages todir="${publish.ssdoci.dir}/${env.version}.${build.number}"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您对
7z
不感兴趣,那么您可以使用 Zip任务。您可以尝试类似的方法而不是...
If you are not particular about
7z
, then you can use the Zip Task.You could try something like this instead of
<copy></copy
...7zip 没有任务 - 和无法使用密码存档。
因此我的解决方案是
There is no task for 7zip - and <zip> cannot archive with password.
My solution is therefore
根据apache.org,支持 7z。
来自 osdir.com 有关于实施
sevenz
任务的工作方式与使用 zip 的方式相同使用 maven ?
在蚂蚁
According to apache.org there is support for 7z.
From osdir.com there are comments on implementing
sevenz
task that works the same way you would use zipUsing maven ?
In ant
我想使用 7z.exe 和“exec”是最好的选择。
语法如下:
C:\Program Files\7-Zip>7z.exe a -t7z c:\temp\test.7z c:\temp*.txt
*此命令将所有 .txt文件从 c:\temp 归档到“test.7z”
干杯!
I guess using 7z.exe with "exec" is the best option.
Here is the syntax:
C:\Program Files\7-Zip>7z.exe a -t7z c:\temp\test.7z c:\temp*.txt
*this command put all .txt file from c:\temp to archive "test.7z"
Cheers!
这里有一个 7z ant 任务:http://www.pharmasoft.be/7z/
不过,还没有测试它,而且该网站似乎已经有点过时了。
There is a 7z ant task available here: http://www.pharmasoft.be/7z/
Did not test it, though, and the site seems already a little dated.