The nbm:build-installers Maven goal allows you to build the platform application installers using Maven, as I wrote about in an earlier blog post. Yesterday I decided to investigate how to configure the installer when building it using that goal.
The first thing that can be customised is which platform(s) to create installers for. This can be configured in the IDE from the application project’s properties, under the Build > Installer category. I chose to build an installer only for Windows. And when I looked at the pom.xml for the application project, I found the following:
Looking at  (see Useful References below), we see that there are a number of other properties that can be set in addition to those now set by the IDE. This includes the parameters that get passed to the template.xml file via the userSettings property. To understand what this actually means, run the nbm:build-installers goal and have a look at the target folder of the application. In the folder targetinstallernbistub you will see the file template.xml. It is the ant script that will get executed during the process of building the installer. And that is the script that the properties get passed to.
The first useful thing is setting the icon that is displayed in the installer when it is running (see also ). After adding the icon, the same section in the pom.xml now looks like this:
However you will most likely not want to stop at the icon, but also change all the other images in the installer (see ). The template.xml provided with NetBeans 7.2 does not allow this out of the box. But the changes are simple (see  for some info towards the bottom of the page and also  as an example of a template.xml). First lets add a new property called nbi.instleftcorner.file that will specify the location of the image to be displayed at the top left of most of the installer wizard pages.
Then we create a copy of the template.xml file and specify the templateFile property in the pom.xml:
The final part of the puzzle is changing the template.xml file to also copy the new file (see  again for a more complete example). As a quick fix, I just added the following
to the -prepare-icon target. Now when the nbm:build-installers goal is executed, the custom template.xml is copied including this change and the wizard-description-background-left.png image will be replaced before the installer gets built. The same can be done for any of the images. 🙂
- NBM Maven Plugin documentation
- Developers FAQ Create Installers
- JIRA Build installers goal proposal
- Geertjan’s Blog: Customizing the NetBeans Platform Installer
- template.xml from osm2garmin
Edit (4 October 2012): Another useful resource:
Edit (1 February 2013): Timon Veenstra of AgroSense provided the following additional very useful information:
“If you want to adjust only the installation folder for windows, you will need to copy the default template.xml and adjust this part:
If you want to adjust all of them, you could change your branding token. But beware that the branding token should be the same as the parent artifactId (without -_[0-9]).”
Also read Timon’s article entitled How to Change a NetBeans Platform Executable Icon with Maven for more valuable information!