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

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

  1. zip as specified by the build-zip target
  2. unzip the result of build zip
  3. do your stuff eg: copy, move, delete, etc
  4. 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>
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo