Skip to main content

Module Suite building tips (part 3)

Posted by richunger on December 20, 2005 at 1:32 PM PST

In this installment, I'll be solving 2 issues with the building of a distributable application from a NetBeans Module Suite:

  1. Including a custom conf file (instead of the default etc/netbeans.conf)
  2. Including the JDK with my distribution

First, let's take a look at my vbuilder.conf file:

# ${HOME} will be replaced by JVM user.home system property
# ${APPNAME} will be replaced by the app name specified
# in the module suite's project properties
default_userdir="${HOME}/${APPNAME}/4.0"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="-J-Xms24m -J-Xmx128m -J-Dnetbeans.logger.console=true"

# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
# relative paths are relative to the root of the netbeans installation
jdkhome="jdk"

Now, I've checked this file into my module suite's nbproject/ directory. Notice that the configuration sets the default JDK to ${NETBEANS_ROOT}/jdk.

In the suite's build script, I need only override one target:

<target name="build-zip" depends="suite.build-zip" description="Builds a ZIP distribution of V-Builder.">
    <zip destfile="dist/${app.name}.zip" update="true">
        <!-- The JDK that's running this ant script -->
        <zipfileset dir="${java.home}/../" prefix="${app.name}/jdk">
            <exclude name="bin/*.exe"/>
            <exclude name="jre/bin/*.exe"/>
            <exclude name="src.zip"/>
            <exclude name="src/**"/>
            <exclude name="demo/**"/>
            <exclude name="sample/**"/>
        </zipfileset>
        <zipfileset dir="${java.home}/../" prefix="${app.name}/jdk" filemode="755">
            <include name="bin/*.exe"/>
            <include name="jre/bin/*.exe"/>
        </zipfileset>

        <!-- vbuilder.conf -->
        <zipfileset dir="nbproject" prefix="${app.name}/etc">
            <include name="${app.name}.conf"/>
        </zipfileset>
    </zip>
</target>

...and that's all there is to it. Now the zip file generated by the IDE's "Build Zip Distribution" action will contain my custom vbuilder.conf and the JDK that was used to build it.

In the next entry, I'll show you how to set up a nightly build process.

Related Topics >>