blob: 7df8d1968013d26002b7ee6a4ea921087ed14b52 [file] [log] [blame]
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
------
Maven 2 NBM Plugin
------
Frantisek Mantlik
<frantisek@mantlik.cz>
------
2012-02-12
HOWTO: Customize installers generated by nbm:build-installers
Generated installers can be customized by providing user-defined
customized templateFile and pass parameters to it with
userSettings parameter.
See {{{./build-installers-mojo.html}<<<build-installers>>> goal}} description.
User defined template can be used to modify generated installer
behavior, e.g. branding of installation environment etc.
*Example 1: Simple change in installer code
Simple changes into original Harness installer code can be made by filtering
corresponding file using Ant in templateFile.
Following code added into <<<prepare-sources>>> target takes rid of the "Run application
when installer finished" checkbox at the last page of installer wizard:
+-----+
<replace file="${installer.build.dir}/ext/engine/src/org/mycompany/installer/wizard/components/panels/PostInstallSummaryPanel.java" encoding="utf-8">
<replacefilter token="runAppNow.doClick();" value="runAppNow.setVisible(false);"/>
</replace>
+-----+
*Example 2: More complex installer code changes
If the code changes become more complex better solution is to replace entire
Harness files with modified versions.
For example, you would like to register file associations for your application.
First of all, prepare your modified version of the file ConfigurationLogic.java
according to the instructions at {{{http://wiki.netbeans.org/NBIFileAssosiations}http://wiki.netbeans.org/NBIFileAssosiations}}.
As a next step add a copy task into <<<prepare-sources>>> target in your templateFile:
+-----+
<copy file="${configuration.logic.file}" overwrite="true" tofile="${installer.build.dir}/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java"/>
+-----+
and finally define <<<configuration.logic.file>>> parameter in the application's pom:
+-----+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
<templateFile>${basedir}/installer/template.xml</templateFile>
<userSettings>
<configuration.logic.file>${basedir}/installer/ConfigurationLogic.java</configuration.logic.file>
</userSettings>
</configuration>
</plugin>
+-----+
*Example 3: Branding of installer images
If installer left corner image has to be branded,
following code can be added to templateFile target
<<<prepare-sources>>>:
+-----+
<condition property="ilc.path" value="${nbi.instleftcorner.file}">
<and>
<isset property="nbi.instleftcorner.file"/>
<available file="${nbi.instleftcorner.file}"/>
</and>
</condition>
<condition property="ilc.defined">
<and>
<isset property="nbi.instleftcorner.file"/>
<available file="${nbi.instleftcorner.file}"/>
</and>
</condition>
<antcall target="-prepare-ilc"/>
+-----+
In addition, new target <<<-prepare-ilc>>> has to be defined, e.g. at the end of templateFile:
+-----+
<target name="-prepare-ilc" if="ilc.defined">
<copy file="${ilc.path}" tofile="${installer.build.dir}/ext/engine/src/org/mycompany/installer/wizard/wizard-description-background-left.png" overwrite="true"/>
</target>
+-----+
which effectively replaces the desired image.
Finally, update application's pom:
+-----+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
<templateFile>${basedir}/installer/template.xml</templateFile>
<userSettings>
<nbi.instleftcorner.file>${basedir}/installer/ilc.png</nbi.instleftcorner.file>
</userSettings>
</configuration>
</plugin>
+-----+
More information: {{{http://wiki.netbeans.org/NBI}http://wiki.netbeans.org/NBI}}