How to get archive name while unzipping
I am using ant unzip task to get contents of a archive file.
Is there a possibility to also save the name of that archive somehow.
Below is the code I am using to unzip an archive.
<unzip dest="${import.dir}">
<fileset dir="${tmp.dir}"&g开发者_C百科t;
<include name="**/*.zip"/>
</fileset>
</unzip>
Regards, Satya
You could use an embedded groovy script
<target name="unzip">
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>
<fileset id="zips" dir="${tmp.dir}" includes="**/*.zip"/>
<groovy>
project.references.zips.each { file ->
ant.echo(message:"message goes here", file:"build.log", append:true)
ant.unzip(src:file, dest:properties["import.dir"])
}
</groovy>
</target>
Groovy task is documented here
精彩评论