<zipfileset> vs. <fileset> in ant
The ant build tool provides two different tasks, <fileset/> and <zipfileset/> . According to the documentation, <zipfileset/> allows us to extract files from a .zip file if we use the src attribute.
My question is , if we use the dir attribute to select files, then what is the difference between them, <zipfileset/> and <fileset/> .
eg.
<zipfileset dir="conf/Gateway> <include name="jndi.properties" /> </zipfileset> and <fileset dir="conf/Gateway> <include name="jndi.properties" /> </fileset> One useful difference between the two tasks, if you are building an archive (e.g. ZIP or WAR or JAR), is that zipfileset has a prefix attribute that you can use to move these files to another folder in the archive. For example, if the following is included in a larger set of fileset and zipfileset elements:
<zipfileset dir="conf/Gateway" prefix="properties"> <include name="jndi.properties" /> </zipfileset> then the conf/Gateway/jndi.properties will actually be included in the result as conf/Gateway/properties/jndi.properties . You can achieve the same goal in other ways, but it is sometimes useful.
Otherwise, just use the task that is most suitable for this task.