Windows Installer for Apache Maven 2

I’ve been playing around with Windows Installer XML (WiX) recently – I used it to create the installer for Year Chart and I’ve since converted a couple of internal projects (I may publish them later) which I had originally created InstallShield installers for (with the version that came with older versions of Microsoft Visual Studio).

So, when I was involved in a discussion about installing Apache Maven 2 earlier this week I thought it sounded an interesting challenge.

The first evening I created the base installer. I’m using Visual Studio 2010 with the Votive plugin for WiX projects and once created I copied and tweaked some of the YearChart install.

To get the Maven 2 binaries, I downloaded the Apache Maven 2.2.1 zipped binaries and expanded them into the project. I used the heat.exe program from the WiX installation to generate a Fragment file for all the Maven files.

Finally, I worked out how to setup the environment variables to support running Maven 2 on the command line: M2_HOME, M2, and adding M2 to Path. I’ve created them as User environment variables rather than System variables to make it easier to change them without Admin access.

Over the rest of the week, I added some Start Menu entries to uninstall the application and link to the Apache Maven web site. I also added the Apache License Version 2.0 – I had to use an RTF version because I couldn’t persuade WiX to use the text version included in the Maven distribution.

Installer

You can download the installer here:

The installer, as with the Apache Maven code, is provided under the Apache License Version 2.0.

This version of the installer includes the following features:

  • Installs Apache Maven 2.2.1 binaries (Jars)
  • Presents the Apache License Version 2.0
  • Configurable install location – defaults to:
    • C:\Program Files\Apache Software Foundation\apache-maven-2.2.1
  • Configures User Environment Variables:
    • M2_HOME – the install location
    • M2 – the bin directory (includes mvn.bat)
    • Path – prepends %M2% to the User path.
  • Adds a Start Menu folder containing:
    • Apache Maven Website URL
    • Uninstall link

NOTE: Maven is a Java tool, so you must have a Java installed in order to proceed. More precisely, you need a Java Development Kit (JDK) version 1.4 or greater , the Java Runtime Environment (JRE) is not sufficient.

Once installed you will be able to run Maven from the command line – you can test this by opening a command window and typing:

mvn -version

What Next?

I have no real reason to do much more with this but if there is sufficient interest I might look at improving the installer. And it might be interesting to try out some other features of WiX – such as custom dialogs.

Let me know if it’s any use to you – or if it you have any problems with it.

Tags: , , , ,
Posted in Java, WiX

Leave a Reply