Wednesday, June 27, 2012

NetBeans Platform customize app.conf in maven build

This short tutorial describes how to customize the app.conf file of a NetBeans Platform based application in the maven build environment.

Every application developed on top of the NetBeans Platform has a file called app.conf
You will find this file in the generated target folder: app/etc

This file describes some startup and runtime parameter of your NetBeans Platform based application.
Here is a simple example how the generated standard app.conf file could look like:

# ${HOME} will be replaced by user home directory according to platform src/main
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}"

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding platonframework -J-Xms24m -J-Xmx256m"
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea

# default location of JDK/JRE

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
By edditing this file you could for example specify a new jdkhome or start the application with more ore less memory. But when you build your application next time all changes will get lost because the NetBeans Platform build system will update this file too and override it with the default values...

But how to customize this file and tell the build-system not to use the defaults?

The easiest way to customize the file is to copy the current content to a new file called e.g. customized.conf - within this file you can change everything you want to. Then you have to tell the nbm-maven-plugin to use your customized.conf file. Just declare the following in the pom of your app-Module inside the build section:

The nbm-maven-plugin will use your file as copy template when building the application. At the end it will still be called app.conf - but with your custom code inside ;-) Very easy but sometimes hard to google that out...


  1. Thanks for the tip! It is also possible to adjust these parameters in main pom.xml ${} -J-Xms24m -J-Xmx256m

    It would be best to force maven to update the the default config file...

  2. ugh.. the XML tags were removed. it should be like this:
    <>-J-Xms24m -J-Xmx256m</>

  3. Hi deric,

    sounds like an easy way to change known things like the runtime parameters.
    I will give this a try - didn't know this feature!

    But if you want to put your own additional properties into the conf-File you have to use the way i described by replacing the whole generated file.

  4. This comment has been removed by the author.