blob: 66a7e2ec4c78bb1ad18ef709c7343f7b8bd32e67 [file] [log] [blame]
<!DOCTYPE html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Apache NetBeans Maven Utilities - NBM Maven Plugin &#x2013; Maven 2 NBM Plugin</title>
<link rel="stylesheet" href="./css/netbeans.css" />
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
</head>
<body>
<div class="top-bar" id="responsive-menu">
<div class='top-bar-left'>
<a class='title' href="http://netbeans.apache.org"><img src='/images/apache-netbeans.svg' style='padding: 8px; height: 48px;'>Apache NetBeans (incubating)</a>
</div>
<div class="top-bar-right">
<ul class="vertical medium-horizontal menu" style="right: 90px;" data-responsive-menu="drilldown medium-dropdown">
<li> <a href="../nb-repository/index.html">NB Repository Plugin</a> </li>
<li> <strong style='line-height: 1;margin-bottom: 0;padding: 0.7rem 1rem;display: block;' >NBM Plugin</strong> </li>
<li> <a href="../shared/index.html">Shared</a> </li>
<li> <a href="../parent/index.html">Parent</a> </li>
</ul>
</div>
</div>
<div class='grid-container main-content'>
<div id="toc" class="toc">
<div id="toctitle">Overview</div>
<ul class="sectlevel1">
<li><a href="index.html">Usage</a></li>
<li><a href="plugin-info.html">Plugin Goals</a></li>
</ul>
<div id="toctitle">HOWTOs</div>
<ul class="sectlevel1">
<li><a href="buildinstexample.html">Customize installers</a></li>
<li><a href="upgrade.html">Upgrade from older versions</a></li>
</ul>
<div id="toctitle">Deprecated</div>
<ul class="sectlevel1">
<li><a href="nbm.html">Descriptor Format</a></li>
<li><a href="descriptor.html">Example Descriptor</a></li>
</ul>
</div>
<div id="preamble">
<div class="sectionbody">
<div class="section">
<h2><a name="HOWTO:_Customize_installers_generated_by_nbm:build-installers"></a>HOWTO: Customize installers generated by nbm:build-installers</h2>
<p>Generated installers can be customized by providing user-defined customized templateFile and pass parameters to it with userSettings parameter. See <a href="./build-installers-mojo.html"><tt>build-installers</tt> goal</a> description.</p>
<p>User defined template can be used to modify generated installer behavior, e.g. branding of installation environment etc.</p>
<div class="section">
<h3><a name="Example_1:_Simple_change_in_installer_code"></a>Example 1: Simple change in installer code</h3>
<p>Simple changes into original Harness installer code can be made by filtering corresponding file using Ant in templateFile.</p>
<p>Following code added into <tt>prepare-sources</tt> target takes rid of the &quot;Run application when installer finished&quot; checkbox at the last page of installer wizard:</p>
<div class="source">
<pre>&lt;replace file=&quot;${installer.build.dir}/ext/engine/src/org/mycompany/installer/wizard/components/panels/PostInstallSummaryPanel.java&quot; encoding=&quot;utf-8&quot;&gt;
&lt;replacefilter token=&quot;runAppNow.doClick();&quot; value=&quot;runAppNow.setVisible(false);&quot;/&gt;
&lt;/replace&gt;</pre></div></div>
<div class="section">
<h3><a name="Example_2:_More_complex_installer_code_changes"></a>Example 2: More complex installer code changes</h3>
<p>If the code changes become more complex better solution is to replace entire Harness files with modified versions.</p>
<p>For example, you would like to register file associations for your application.</p>
<p>First of all, prepare your modified version of the file ConfigurationLogic.java according to the instructions at <a class="externalLink" href="http://wiki.netbeans.org/NBIFileAssosiations">http://wiki.netbeans.org/NBIFileAssosiations</a>.</p>
<p>As a next step add a copy task into <tt>prepare-sources</tt> target in your templateFile:</p>
<div class="source">
<pre>&lt;copy file=&quot;${configuration.logic.file}&quot; overwrite=&quot;true&quot; tofile=&quot;${installer.build.dir}/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java&quot;/&gt;</pre></div>
<p>and finally define <tt>configuration.logic.file</tt> parameter in the application's pom:</p>
<div class="source">
<pre>&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;nbm-maven-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;templateFile&gt;${basedir}/installer/template.xml&lt;/templateFile&gt;
&lt;userSettings&gt;
&lt;configuration.logic.file&gt;${basedir}/installer/ConfigurationLogic.java&lt;/configuration.logic.file&gt;
&lt;/userSettings&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;</pre></div></div>
<div class="section">
<h3><a name="Example_3:_Branding_of_installer_images"></a>Example 3: Branding of installer images</h3>
<p>If installer left corner image has to be branded, following code can be added to templateFile target <tt>prepare-sources</tt>:</p>
<div class="source">
<pre>&lt;condition property=&quot;ilc.path&quot; value=&quot;${nbi.instleftcorner.file}&quot;&gt;
&lt;and&gt;
&lt;isset property=&quot;nbi.instleftcorner.file&quot;/&gt;
&lt;available file=&quot;${nbi.instleftcorner.file}&quot;/&gt;
&lt;/and&gt;
&lt;/condition&gt;
&lt;condition property=&quot;ilc.defined&quot;&gt;
&lt;and&gt;
&lt;isset property=&quot;nbi.instleftcorner.file&quot;/&gt;
&lt;available file=&quot;${nbi.instleftcorner.file}&quot;/&gt;
&lt;/and&gt;
&lt;/condition&gt;
&lt;antcall target=&quot;-prepare-ilc&quot;/&gt;</pre></div>
<p>In addition, new target <tt>-prepare-ilc</tt> has to be defined, e.g. at the end of templateFile:</p>
<div class="source">
<pre>&lt;target name=&quot;-prepare-ilc&quot; if=&quot;ilc.defined&quot;&gt;
&lt;copy file=&quot;${ilc.path}&quot; tofile=&quot;${installer.build.dir}/ext/engine/src/org/mycompany/installer/wizard/wizard-description-background-left.png&quot; overwrite=&quot;true&quot;/&gt;
&lt;/target&gt;</pre></div>
<p>which effectively replaces the desired image.</p>
<p>Finally, update application's pom:</p>
<div class="source">
<pre>&lt;plugin&gt;
&lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
&lt;artifactId&gt;nbm-maven-plugin&lt;/artifactId&gt;
&lt;configuration&gt;
&lt;templateFile&gt;${basedir}/installer/template.xml&lt;/templateFile&gt;
&lt;userSettings&gt;
&lt;nbi.instleftcorner.file&gt;${basedir}/installer/ilc.png&lt;/nbi.instleftcorner.file&gt;
&lt;/userSettings&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;</pre></div>
<p>More information: <a class="externalLink" href="http://wiki.netbeans.org/NBI">http://wiki.netbeans.org/NBI</a></p></div></div>
</div>
</div>
</div>
<div class='grid-container incubator-area' style='margin-top: 64px'>
<div class='grid-x grid-padding-x'>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/">
<img style="width: 320px" title="Apache Software Foundation" src="/images/asf_logo_wide.svg" />
</a>
</div>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/events/current-event.html">
<img style="width:234px; height: 60px;" title="Apache Software Foundation current event" src="https://www.apache.org/events/current-event-234x60.png"/>
</a>
</div>
</div>
</div>
<div class='footer-disclaimer'>
<div class="footer-disclaimer-content">
<p>Copyright &copy; 2017-2018 <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Licensed under the Apache <a href="https://www.apache.org/licenses/">license</a>, version 2.0</p>
<p><a href="https://incubator.apache.org/" alt="Apache Incubator"><img src='/images/incubator_feather_egg_logo_bw_crop.png' title='Apache Incubator'></img></a></p>
<div style='max-width: 40em; margin: 0 auto'>
<p>Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p>
<p>Apache Incubator, Apache, the Apache feather logo, the Apache NetBeans logo, and the Apache Incubator project logo are trademarks of <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Oracle and Java are registered trademarks of Oracle and/or its affiliates.</p>
</div>
</div>
</div>
<a href="https://github.com/apache/incubator-netbeans-mavenutils"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<script src="/js/vendor/jquery-3.2.1.min.js"></script>
<script src="/js/vendor/what-input.js"></script>
<script src="/js/vendor/jquery.colorbox-min.js"></script>
<script src="/js/vendor/foundation.min.js"></script>
<script src="/js/netbeans.js"></script>
<script>
$(function(){ $(document).foundation(); });
</script>
</body>