Last Published: 2009-03-27  | Version: 0.2.0-M1 | Insight > Release Engineering

Usage

The NSIS Plug-in is designed to participate in the package phase of the build process. Once you configure the plug-in, you may execute the plug-in by invoking

mvn package

The individual goals of the package can also be invoked as

mvn nsis:<goal>

Where goal is one of the existing goals of the plug-in.

nsis:clean Goal

Unlike the Maven clean goal, the nsis:clean goal does not clean the entire target directory but just the plug-ins work directory. By default this is ${project.build.directory}/nsis-work

Configuration

This plug-in requires two configurations to run:

pom.xml Configuration

The plug-in needs to be defined in the pom.xml with the following required configuration:

<project>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>com.mindtree.techworks.insight.releng</groupId>
                <artifactId>maven-nsis-plugin</artifactId>
                <version>0.2.0M1</version>
                <configuration>
                    <projectFile>/path/to/nsis/project/file</projectFile>
                </configuration>
            </plugin>
            ...
        </plugins>
        ...
    </build>
    ...
</project>

The other optional configurations of this section can be seen in the goal configuration page.

NSIS Install Directory

This plug-in requires NSIS to be installed on the system where the build is being executed. Once NSIS has been installed, there are multiple ways in which the plug-in can get to the nsis executable file required.

  • System Path: The directory containing the nsis executable file can be defined in the system path, and the plug-in can get to it.
  • pom.xml configuration: The plug-in configuration parameter nsisPath can be configured to point to the directory containing the nsis executable.
  • pom.xml property: The plug-in configuration parameter nsisPath can be configured as a property in the pom of the project or a parent project.
  • Command line option OR System Variable: The variable nsisPath can be defined at runtime as a system variable or using the maven runtime option as -DnsisPath=/path/to/dir/containing/nsis/executable.

NOTE: The NSIS Install directory is required only for the compile goal.

NSIS Executable

The default NSIS executable on Windows is makensis.exe. Until version 0.1 of the plug-in, this name was the only one used by the plug-in to invoke NSIS. From maven-nsis-plugin version 0.2.0 this behavior has been changed, and makensis.exe is now used as a default name for the NSIS executable. Users may override the executable's name using the nsisExec parameter.

As the nsisPath parameter, nsisExec may be specified in multiple ways:

  • Default: When the parameter is not specified, it defaults to makensis
  • pom.xml configuration: The plug-in configuration parameter nsisExec can be configured to specify the name of the NSIS executable.
  • pom.xml property: The plug-in configuration parameter nsisExec can be configured as a property in the pom of the project or a parent project.
  • Command line option OR System Variable: The variable nsisExec can be defined at runtime as a system variable or using the maven runtime option as -DnsisExec=name_of_nsis_executable.

An additional benefit of this parameter is that it allows using the plug-in on a *nix machine Feature Request 2014237. Though NSIS is designed to run on Windows machines only, it can be compiled and run on Linux, see http://www.xdevsoftware.com/blog/post/How-to-Install-the-Nullsoft-Installer---NSIS-on-Linux-.aspx.

NOTE: The NSIS executable name is required only for the compile goal.

NSIS Project configuration

The NSIS project configuration is used for information to generate information and specialization of the installer script for information not available from the pom.xml file of the project.

An annotated configuration of the current version of the project xml is available at NSIS Project Xref. An example configuration file used for insight UI is also available at insight-nsis-proj.html.

Using dependency sets

The plug-in currently uses the Maven Artifact component for dependency resolution and filtering (includes and excludes). To use the filters in the plug-in, the elements need to be specified as groupId:artifactIds. So, if you want to exclude artifact.jar from group foo.bar, you need to specify the exclusion as:

<dependencySets> 
    <dependencySet> 
        <outputDirectory>lib</outputDirectory> 
        <excludes> 
            <exclude>foo.bar:artifact</exclude> 
        </excludes>                                                     
    </dependencySet> 
</dependencySets>

We may move to using the Maven Common Artifact Filters and File Management modules in the future for better file, folder and artifact handling. Note to self: open feature requests for these.

Default Language Selection

The default language of any installer generated by this plug-in is English, but it is possible to change the default language of the installer. To do so, set the defaultInstallerLanguage element under nsisProject/projectInfo.

<nsisProject>
        <projectInfo>
                ...
                <defaultInstallerLanguage>English</defaultInstallerLanguage>
        </projectInfo>
        ...
</nsisProject>

The language selected should be one that is present under Contrib/Language files directory of your NSIS installation and is case sensitive.

Maven Repository Configuration

The NSIS plug-in is currently not available at the Maven Central repository, hence to get your maven build system to get the plug-in, you may use the temporary Insight Maven 2 repository at: