MPNSIS-9. nsis-plugin should not depend on dist props, should support deploy and install

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion 2004-10-01 05:05:14 +00:00
parent 113fe374e0
commit 794667cfe1
9 changed files with 99 additions and 27 deletions

View File

@ -21,6 +21,7 @@
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:artifact="artifact"
xmlns:license="license"
xmlns:maven="jelly:maven"
xmlns:util="jelly:util">
@ -32,14 +33,17 @@
<goal name="nsis"
description="Generate NSIS Installer .exe"
prereqs="nsis:installer">
<ant:echo>Installer generated successfully</ant:echo>
</goal>
<goal name="nsis:generate-project"
description="Generate NSIS project.nsh file">
<maven:get var="maven.dist.bin.assembly.dir" plugin="maven-dist-plugin" property="maven.dist.bin.assembly.dir"/>
<maven:param-check value="${maven.dist.bin.assembly.dir}" fail="true"
message="'maven.dist.bin.assembly.dir' must be specified. It is the directory containing files to be placed in the installer"/>
<!-- if maven.nsis.build.dir isn't specified, grab the dist setting -->
<j:if test="${context.getVariable('maven.nsis.build.dir') == null}">
<maven:get var="maven.nsis.build.dir" plugin="maven-dist-plugin" property="maven.dist.bin.assembly.dir"/>
</j:if>
<maven:param-check value="${maven.nsis.build.dir}" fail="true"
message="'maven.nsis.build.dir' must be specified. It is the directory containing files to be placed in the installer"/>
<mkdir dir="${maven.build.dir}"/>
@ -80,14 +84,74 @@
<j:if test="${!nsisExeFile.exists()}">
<fail>The NSIS executable '${maven.nsis.exe}' could not be found</fail>
</j:if>
<maven:get var="maven.dist.dir" plugin="maven-dist-plugin" property="maven.dist.dir"/>
<mkdir dir="${maven.dist.dir}"/>
<!-- call makensis.exe with the setup.nsi file -->
<ant:exec executable="${maven.nsis.exe}" failonerror="true">
<arg value="/V2"/>
<arg value="${script}"/>
</ant:exec>
<ant:echo>Installer ${maven.build.dir}/${maven.nsis.final.name}.exe generated successfully</ant:echo>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y S N A P S H O T -->
<!-- ================================================================== -->
<goal
name="nsis:deploy-snapshot"
prereqs="nsis:installer"
description="Deploy a snapshot exe to the remote repository">
<artifact:deploy-snapshot
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- D E P L O Y J A R -->
<!-- ================================================================== -->
<goal
name="nsis:deploy"
prereqs="nsis:installer"
description="Deploy an exe to the remote repository">
<artifact:deploy
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- I N S T A L L J A R -->
<!-- ================================================================== -->
<goal name="nsis:install" prereqs="nsis:installer"
description="Install the exe in the local repository">
<artifact:install
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- I N S T A L L S N A P S H O T -->
<!-- ================================================================== -->
<goal
name="nsis:install-snapshot" prereqs="nsis:installer"
description="Install a snapshot exe in the local repository">
<artifact:install-snapshot
artifact="${maven.build.dir}/${maven.nsis.final.name}.exe"
type="exe"
project="${pom}"
/>
</goal>
</project>

View File

@ -43,3 +43,9 @@ maven.nsis.logo.position=left
# size of the logo on the first page
#maven.nsis.logo.widthHeight=
# directory containing contents to be bundled
maven.nsis.build.dir=
# name of generated exe
maven.nsis.final.name=${maven.final.name}

View File

@ -21,7 +21,7 @@
<pomVersion>3</pomVersion>
<name>Maven NSIS Plug-in</name>
<artifactId>maven-nsis-plugin</artifactId>
<currentVersion>1.2-SNAPSHOT</currentVersion>
<currentVersion>2.0-SNAPSHOT</currentVersion>
<organization/>
<description>A plugin to generate Win32 installer programs using NSIS</description>
<shortDescription>NSIS Plugin for Maven</shortDescription>

View File

@ -25,16 +25,16 @@
<maven:get var="maven.license.licenseFile" plugin="maven-license-plugin" property="maven.license.licenseFile"/>
<maven:makeAbsolutePath var="license" basedir="${basedir}" path="${maven.license.licenseFile}"/>
<maven:makeAbsolutePath var="build" basedir="${basedir}" path="${maven.build.dir}"/>
<maven:makeAbsolutePath var="dist" basedir="${basedir}" path="${maven.dist.bin.assembly.dir}"/>
<maven:makeAbsolutePath var="dist" basedir="${basedir}" path="${maven.nsis.build.dir}"/>
<ant:tstamp />
; template for project details
; generated by ${user.name} from project.xml version ${pom.currentVersion}
; on date ${TODAY}, time ${TSTAMP}
!define PROJECT_BUILD_DIR "${build}"
!define PROJECT_DIST_BIN_DIR "${maven.dist.bin.assembly.dir}"
!define PROJECT_DIST_DIR "${maven.dist.dir}"
!define PROJECT_FINAL_NAME "${maven.final.name}"
!define PROJECT_DIST_BIN_DIR "${maven.nsis.build.dir}"
!define PROJECT_DIST_DIR "${maven.build.dir}"
!define PROJECT_FINAL_NAME "${maven.nsis.final.name}"
<util:available file="${license}">
!define PROJECT_LICENSE_FILE "${license}"
!define PROJECT_LICENSE_TEXT "${maven.nsis.license.text}"

View File

@ -25,7 +25,8 @@
</properties>
<body>
<release version="1.2-SNAPSHOT" date="In CVS">
<release version="2.0-SNAPSHOT" date="In CVS">
<action dev="dion" type="fix" due-to="Matthias Kerkhoff" issue="MPNSIS-9">Use maven.nsis.build.dir instead of maven.dist.assembly.dir.</action>
<action dev="dion" type="fix" due-to="Matthias Kerkhoff" issue="MPNSIS-8">Fail when makensis fails.</action>
<action dev="dion" type="update">Rename <code>ORGANIZATION</code> constant to <code>PROJECT_ORGANIZATION</code>.</action>
<action dev="dion" type="fix" due-to="Geoffrey">Check maven.nsis.exe exists before using it.</action>
@ -43,7 +44,7 @@
<code>PROJECT_DIST_DIR</code>constant to
<code>PROJECT_DIST_BIN_DIR</code>, and define
<code>PROJECT_DIST_DIR</code>to be
<code>${maven.dist.dir&gt;</code>
<code>${maven.dist.dir}</code>
</action>
<action dev="dion" type="update">Add docs on how the plugin process works</action>
<action dev="dion" type="update">Add some basic documentation</action>

View File

@ -83,9 +83,9 @@
<table>
<tr><th>Constant</th> <th>Value</th></tr>
<tr><td>PROJECT_BUILD_DIR</td> <td>${maven.build.dir}</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_FINAL_NAME</td> <td>${maven.final.name}</td></tr>
<tr><td>PROJECT_DIST_BIN_DIR</td> <td>${maven.nsis.build.dir}</td></tr>
<tr><td>PROJECT_DIST_DIR</td> <td>${maven.build.dir}</td></tr>
<tr><td>PROJECT_FINAL_NAME</td> <td>${maven.nsis.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_LOGO</td> <td>${maven.nsis.logo}</td></tr>

View File

@ -11,12 +11,12 @@
<answer>
<p>
With the default templates, all the files from the directory denoted by the
<code>maven.dist.bin.assembly.dir</code> property are installed,
<code>maven.nsis.build.dir</code> property are installed,
together with an uninstaller if the end-user so desires.
</p>
<p>
If you call the dist goal before calling the nsis goal,
it will set the property correctly and generate files into that directory.
If you call the dist goal before calling the nsis goal, e.g. (maven dist nsis),
it will set the property correctly.
</p>
</answer>
</faq>
@ -82,15 +82,15 @@ maven.nsis.exe=C:/develop/build/NSIS/makensis.exe
<faq id="troubleshooting.assemblyDir">
<question>
Why am I getting <code>org.apache.commons.jelly.JellyTagException: ...
'maven.dist.bin.assembly.dir' must be specified ...</code>
'maven.nsis.build.dir' must be specified ...</code>
when I run the <code>nsis</code> goal?
</question>
<answer>
<p>
The nsis goal counts on the <code>maven.dist.bin.assembly.dir</code> property being set.
Normally the dist goal does this. You could also pass it in when running the goal, e.g.
The nsis goal counts on the <code>maven.nsis.build.dir</code> property being set.
You could also pass it in when running the goal, e.g.
</p>
<source>maven -Dmaven.dist.bin.assembly.dir=c:/develop/build/files nsis</source>
<source>maven -maven.nsis.build.dir=c:/develop/build/files nsis</source>
</answer>
</faq>
</part>

View File

@ -64,12 +64,13 @@
<section name="Using the NSIS Plugin">
<p>
The plugin creates an installation program from your <code>distribution</code>,
as created by <code>maven dist</code>. The <code>dist</code> goal must be
as created by <code>maven dist</code>. The <code>dist</code> goal is usually
run before using the plugin.
</p>
<p>
Once you've run <code>dist</code>, run the <code>nsis</code> goal. This
produces an executable in <code>${maven.build.dir}/${maven.final.name}.exe</code>
Once you've run <code>dist</code>, or created your directory with the installation contents,
run the <code>nsis</code> goal. This produces an executable in
<code>${maven.build.dir}/${maven.nsis.final.name}.exe</code>
</p>
</section>
</body>

View File

@ -27,7 +27,7 @@
<body>
<section name="How it works">
<p>
The process of creating an installer from your <code>${maven.dist.bin.dir}</code>
The process of creating an installer from your <code>${maven.nsis.build.dir}</code>
using the plugin is as follows:
<ol>
<li>