Friday, September 18, 2009

Update build zip distribution with additional files

Inspired by a discussion on the NetBeans Developer Forum, (, and seen multiple struggeling with this, I would like to capture how to add some files or directories to the ZIP distro file on build

Suppose you have a directory in your sandbox you would like to add to the distro. This could be source code from an OpenSource project you have edited and hence have to make public, or some other directories. You may already have choosen to add the target build-launchers to copy those to the build directory like:

<target name="build-launchers" depends="">
<copy todir="${build.launcher.dir}">
<fileset dir="MyExtraDirectory"/>

You can hereafter add the target which will add this directory to the zip file build simply by leveraging ant commands

<!-- Customized build-zip target to copy reports to the distribution -->
<target name="build-zip" depends=quot;">
<!-- Update the just created ZIP with additional directories/data -->
<echo message="Adding MyExtraDirectory ..."/>
<zip destfile="${dist.dir}/${}.zip" update="true">
<zipfileset dir="${build.launcher.dir}/MyExtraDirectory/" prefix="${}/MyExtraDirectory"/>


No comments:

Post a Comment