This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • How to build an IzPack installer
Skip to end of metadata
Go to start of metadata

The helps.

Example adding some files to a pack. Includes some integration tests.:

require 'buildrizpack'
define 'example_3', :version => '0.9.8' do
myJavaFile = "example_3/src/main/java/"
myFirstTextFile = path_to(:target)+"/1_5.txt"
mySecondTxtFile = path_to(:target)+"/3_7.txt"
myInstXml = path_to(:target, 'myInstaller.xml')
myInstaller = _('deploy/myInstaller.jar')
Buildr::write myJavaFile, "public class Hello {}" if !File.exists?(myJavaFile)

  1. :file attribute must appear on the first call to package(:izpack) or it will have no effet
    package(:izpack, :file => myInstaller).locales = 'eng', 'fra', 'deu'
  1. we create file task for each file to be packed
    file(myFirstTextFile) do Buildr.write(myFirstTextFile, "This is file 1_5.txt") end
    file(mySecondTxtFile) do Buildr.write(mySecondTxtFile, "This is file 3_7.txt") end
  1. Use the BuildrIzPack::Pack to pack some files
    pack ='myPackName', 'myPack description')
    pack.addFile(mySecondTxtFile, "$INSTALL_PATH/another_name")
  1. Create a custom installer.xml as there are just too many options to find a simple,
  2. less complex, easy to use abstraction. And XmlMarkup is easy to read & create!
    file(myInstXml => [package(:jar).to_s, myFirstTextFile, mySecondTxtFile]) do
    xm =>, 'w+'), :indent => 2)
    xm.installation('version'=>'1.0') {
    xm.tag!('info') { xm.appversion(project.version); xm.appname( }
    xm.guiprefs('width' => '400', 'height' => '400', 'resizable' => 'no')
    xm.panels { |x| xm.panel('classname' => 'InstallPanel') }
    xm.locale { |x| xm.langpack('iso3'=>'eng') }
    xm.packs {
  1. Specify an explizit dependency to the installer.xml file
    package(:izpack).input = myInstXml
    file(package(:izpack).to_s => myInstXml)
  1. It is always a good idea to check whether your buildr project had the desired effect.
  2. Therefore I love to add some integration tests like
    check package(:izpack), 'checks, whether IzPack installer works correctly' do
    File.should exist(myJavaFile)
    File.should exist(myInstXml)
    File.should exist(myInstaller)
    content = IO.readlines(myInstXml).join('')
    content.should match(/installation/)
    content.should match(/\$INSTALL_PATH\/another_name/)
    content.should match(/pack name="myPackName"/)
    content.should match(/<description>myPack description<\/description>/)
    content.should match(/target="\$INSTALL_PATH\/plugins\/1_5.txt"/)
    content.should match(/target="\$INSTALL_PATH\/another_name"/)


  • No labels