Showing posts with label izpack. Show all posts
Showing posts with label izpack. Show all posts

Friday, October 24, 2008

Creating shortcuts with IzPack

IzPack is an excellent tool for deploying your software. During the wizard installation process you can create some shortcuts (on Windows or Linux). To enable shortcuts there are a few changes required in your install.xml, then the actual shortcut information is contained in seperate xml files.

First edit your install.xml by adding:
<panels>
...(other panels)...
<panel classname="ShortcutPanel"/>
...(other panels)...
</panels>

(Required for Windows only)
<native
type="izpack" name="ShellLink.dll"/>


This ensures the shortcut panel will be present in your installer and the native libraries required for Windows are included. Next specify two shortcuts, one to your application (so a jar) and one to a local HTML file (your documentation). You can alter the file names, as long as you tell install.xml where to find the files.

For Windows, shortcutSpec.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<shortcuts>
<skipIfNotSupported/>
<programGroup defaultName="MyApp"
location="applications"/>

<shortcut
name="wekautils"
target="$INSTALL_PATH\MyApp.jar"
description="Launch app"
workingDirectory="$INSTALL_PATH"
iconFile="$INSTALL_PATH\images\logo.ico"
initialState="normal"
programGroup="yes"
desktop="yes"
applications="no"
startMenu="no"
startup="no">


<createForPack name="Core"/>
</shortcut>

<shortcut
name="Documentation"
target="$INSTALL_PATH\doc\index.html"
description="Launch documentation"
initialState="normal"
programGroup="yes"
desktop="no"
applications="no"
startMenu="no"
startup="no">

<createForPack name="Core"/>
</shortcut>


</shortcuts>
and for Linux, slightly altered format, Unix_shortcutSpec.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<shortcuts>
<skipIfNotSupported/>
<programGroup defaultName="MyApp"
location="applications"/>

<shortcut
name="MyApp"
target="/usr/bin/java"
commandLine="-jar $INSTALL_PATH/MyApp.jar"
description="Launch MyApp"
iconFile="$INSTALL_PATH/images/MyApp.png"
workingDirectory="$INSTALL_PATH"
initialState="normal"
programGroup="yes"
desktop="no"
applications="no"
startMenu="no"
startup="no"
type="Application"
terminal="true"
encoding="UTF-8">


<createForPack name="Core"/>
</shortcut>

<shortcut
name="Documentation"
description="Launch documentation"
initialState="normal"
programGroup="yes"
desktop="no"
applications="no"
startMenu="no"
startup="no"
type="link"
url="$INSTALL_PATH/doc/index.html"
terminal="false"
encoding="UTF-8">


<createForPack name="Core"/>
</shortcut>

</shortcuts>

See the IzPack website for further documentation.

Saturday, October 11, 2008

IzPack & CruiseControl

I have CruiseControl configured to run IzPack after successfully compiling and testing my code. Thanks to ant integration this is very easy, see here. Izpack has a few other tricks, namely izpack2app and izpack2exe. These python scripts wrap your newly created installer.jar into either a Mac OS X application or a Window executable. Users of these platforms can now run them without the command-line. I've added these steps into CruiseControl so after each build my artifacts tab gives me 3 versions of my installer. The Mac OS application is actually a folder, so zip that up as CC won't have a folder as an artifact.

Edit your config.xml to include something like this:

<schedule interval="3600">
<composite>
<ant antworkingdir="checkout/${project.name}"
buildfile="build.xml" target="izpack" />
<exec workingdir="checkout/${project.name}/dist"
command="/usr/bin/python"
args="/Applications/IzPack/utils/izpack2app/izpack2app.py
installer.jar installer.app"/>
<exec workingdir="checkout/${project.name}/dist"
command="/usr/bin/tar" args="cvfz installer.zip installer.app" />
<exec workingdir="checkout/${project.name}/dist"
command="/usr/bin/python"
args="/Applications/IzPack/utils/izpack2exe/izpack2exe.py
--file=installer.jar --output=installer.exe --no-upx />
</composite>
</schedule>

The four steps are compile from your build.xml, giving your installer.jar. Create the Mac app, zip it, then create the Windows executable. You need 7Zip for the Windows part, Mac users get it via MacPorts: sudo port install p7zip. Don't forget to add the new files to your artifactspublisher.

Friday, June 27, 2008

Deploy your software with IzPack

In terms of free software packagers there are two contenders for me NSIS and IzPack. NSIS is restricted to Windows, so on its own isn't suitable for my needs. IzPack is Java-based, so instantly suitable for every major platform. Granted it is ideal for Java software, but it is not at all restricted to it. Obviously you need a Java runtime environment (JRE) installed to run, but that is common enough nowadays.

A run down of the features:
  • Open source
  • Cross-platform
  • Fully customisable
  • Native integration (Shortcuts for Windows and Linux)
  • Ant integration
  • Uninstaller
  • Unattended mode
  • User input
  • Translations
Just like ant all your settings are stored in a XML file and parsed to create your customised package.

One of the advantages of IzPack being Java-based means you can add it directly to our continuous integration environment, using the Ant integration. That of course runs using CruiseControl, as the final step after compiling and testing our code (courtesy of JUnit), IzPack can step into package my software. So for each build I can take away an ready-to-deploy package.