NbPlatformBuildTrick
Netbeans Platform Ant based build system trick
Adapted from: http://blogs.kiyut.com/tonny/2008/02/18/netbeans-platform-ant-based-build-system-trick/
If you build an application on top of Netbeans Platform, you probably already know that it is using Apache Ant as the build system. Thanks to this flexibility of Netbeans Platform (ant based build system), this system allow us to do various trick to automate stuff. For example
- Netbeans Platform Branding and version info
- Netbeans Platform and Default User Directory Settings
- Deploy Netbeans Platform based Application using IzPack Installer
This time the trick is how to override build-zip ant target to add your own files eg: license file, properties or configuration files, etc
Basically it is just
- zip as specified by the build-zip target
- unzip the result of build zip
- do your stuff eg: copy, move, delete, etc
- zip again
<!-- step (1) see depend suite.build-zip -->
<target name="build-zip" depends="suite.build-zip">
<property name="nbdist.dir" value="dist"/>
<property name="release.dir" value="${nbdist.dir}/${app.name}"/>
<!-- step (2) unzip the result -->
<unzip src="${nbdist.dir}/${app.name}.zip" dest="${nbdist.dir}"/>
<!-- step (3) do your copying stuff here, check the ant doc for copy, move, etc file -->
<!-- step (4) zip again -->
<zip destfile="${nbdist.dir}/${app.name}-updated.zip">
<zipfileset dir="${release.dir}" prefix="${app.name}"/>
</zip>
<echo message=" "/>
<echo message="cleaning and finalizing release" />
<delete dir="${release.dir}"/>
</target>
