maven-plugins/nsis/xdocs/customizing.xml

180 lines
7.2 KiB
XML

<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed 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.
*/
-->
<document>
<properties>
<title>Maven NSIS Plug-in</title>
<author email="dion@apache.org">dIon Gillard</author>
</properties>
<body>
<section name="Overview">
<ol>
<li><a href="#Customizing">Customizing</a></li>
<li><a href="#Default_Templates">Default Templates</a></li>
<li><a href="#Default_Template_Scripts">Default Template Scripts</a></li>
<li><a href="#Custom_Templates">Custom Templates</a></li>
</ol>
</section>
<section name="Customizing">
<p>
You can customize the installer either
by providing your own scripts that the existing templates
includes, or you can provide your own templates.
</p>
<p>
Of these, the easiest is to provide your own scripts to supplement the
default templates. The most complex is to provide your own custom
templates.
</p>
<p>
No matter which way you decide to customize the installation process,
you will need to be familiar with
<a href="http://nsis.sourceforge.net/">NSIS</a> and have easy
access to the <a href="http://nsis.sourceforge.net/Docs/">NSIS Docs</a>.
</p>
<p>
We've also found the <a href="http://hmne.sourceforge.net/">HM NIS EDIT</a>
tool, which is a free NSIS Editor/IDE, very useful.
</p>
</section>
<section name="Default Templates">
<p>
The plugin provides two templates by default:
<ol>
<li>
<code>project.jelly</code> to get access to information in
<code>project.xml</code> from within NSIS scripts.
</li>
<li>
<code>setup.jelly</code> which generates the final script for NSIS
compilation.
</li>
</ol>
</p>
<subsection name="project.jelly">
<p>
This template produces a file (<code>${maven.build.dir}/project.nsi</code>)
which is included in the generated setup file.
</p>
<p>
The template makes available select values from the <code>project.xml</code>
for use in the installation process as constants, i.e. using the NSIS
<code>!define</code> statement.
</p>
<table>
<tr><th>Constant</th> <th>Value</th></tr>
<tr><td>ORGANIZATION</td> <td>${pom.organization}</td></tr>
<tr><td>PROJECT_BUILD_DIR</td> <td>${maven.build.dir}</td></tr>
<tr><td>PROJECT_FINAL_NAME</td> <td>${maven.final.name}</td></tr>
<tr><td>PROJECT_LICENSE_FILE</td> <td>${maven.license.licenseFile}</td></tr>
<tr><td>PROJECT_LICENSE_TEXT</td> <td>${maven.nsis.license.text}</td></tr>
<tr><td>PROJECT_NAME</td> <td>${pom.name}</td></tr>
<tr><td>PROJECT_REG_KEY</td> <td>SOFTWARE\${pom.organization}\${pom.name}\${pom.currentVersion}</td></tr>
<tr><td>PROJECT_REG_UNINSTALL_KEY</td> <td>Software\Microsoft\Windows\CurrentVersion\Uninstall\${pom.name} ${pom.currentVersion}</td></tr>
<tr><td>PROJECT_STARTMENU_FOLDER</td> <td>$$SMPROGRAMS\${pom.organization}\${pom.name} ${pom.currentVersion}</td></tr>
<tr><td>PROJECT_VERSION</td> <td>${pom.currentVersion}</td></tr>
<tr><td>PROJECT_DIST_BIN_DIR</td> <td>${maven.dist.bin.assembly.dir}</td></tr>
<tr><td>PROJECT_DIST_DIR</td> <td>${maven.dist.dir}</td></tr>
<tr><td>PROJECT_LOGO</td> <td>${maven.nsis.logo}</td></tr>
</table>
</subsection>
<subsection name="setup.jelly">
<p>
This template produces a file (<code>${maven.build.dir}/setup.nsi</code>)
which is used by the NSIS 'compiler', <code>makensis.exe</code> to
produce the installer.
</p>
<p>
The file, when processed, includes other files which you can optionally
provide, to add functionality to the installer. The property,
<code><a href="properties.html">${maven.nsis.src}</a></code>, which defaults to
<code>${basedir}/src/nsis</code>, is where you can place any NSIS source
files which you want included.
</p>
<p>
The <code>setup.nsh</code> file that is generated uses following list
of directories to search for files to include:
<ol>
<li><code>${maven.nsis.src}</code> if it exists,</li>
<li><code>${maven.build.dir}</code></li>
<li><code>${plugin.resources}</code></li>
</ol>
So anything in your NSIS source will override the defaults.
</p>
<p>
The generated setup.nsh file includes the following files:
</p>
<table>
<tr><th>File</th><th>Purpose</th></tr>
<tr>
<td>before-install.nsh</td>
<td>Allow customization of code to be run before the install, e.g. check JAVA_HOME etc</td>
</tr>
<tr>
<td>BrandingImage.nsh</td>
<td>Adds a macro to display the project logo on the installer</td>
</tr>
<tr>
<td>desktop-shortcuts.nsh</td>
<td>Allow customization of desktop shortcuts to be added</td>
</tr>
<tr>
<td>Environment.nsh</td>
<td>Adds functionality to set environment variables</td>
</tr>
<tr>
<td>JDK.nsh</td>
<td>Adds a function to check for <code>JAVA_HOME</code> being set</td>
</tr>
<tr>
<td>project.nsh</td>
<td>The generated file with project details as constants</td>
</tr>
<tr>
<td>registry.nsh</td>
<td>Allow customization of environment variables and registry entries to be written</td>
</tr>
<tr>
<td>registry-uninstall.nsh</td>
<td>Allow customization of environment variables and registry entries to be removed on uninstall</td>
</tr>
<tr>
<td>startmenu-shortcuts.nsh</td>
<td>Allow start menu shortcuts to be added</td>
</tr>
</table>
<p>
Typically you wont provide overrides for BrandingImage.nsh,
Environment.nsh and JDK.nsh, as these are utilities used in the setup.nsh
script.
</p>
</subsection>
</section>
<section name="Default Template Scripts">
</section>
<section name="Custom Templates">
</section>
</body>
</document>