Laying out your project files for a Maven build

It is a good idea to collect your files and assets into the Maven project where your POM file resides.

Bearing in mind that a maven clean command will delete the target folder, we will not put anything there that we want preserved.

You are free to put things in any structure that you want but we make the fillowing suggestion.

We will put our files that we want included in a src folder tree.

Under src, we will create a main sub-folder and under that will create a izPack folder which will be the root of the files for the installation.

File Layout
MyInstallProject
-src
  -main
    -izpack
-target
 pom.xml 

Install.xml

You need to create an install.xml file that describes how you want your installation package to be built. We will discuss the content of this file in great detail later on.

For now we can create the initial <installation> entry to get started

File Layout
<installation version="5.0">
</installation>

This gives us the following folder structure.

File Layout
MyInstallProject
-src
  -main
    -izpack
      install.xml
 -target
 pom.xml 

Other resources

Under the scr/main/izpack, you can create folders to hold the various files that you want to include in your installation.

These might include:

  • legal for licenses
  • doc for documentation
  • images for splash pages and other bitmap images
  • about for product descriptions
File Layout
MyInstallProject
-src
  -main
    -izpack
      -about
         productDescription.txt
      -doc 
        cheatsheet.pdf
        manual.pdf
      -images
        splash.png
      -legal
        license.txt
      install.xml
 -target
 pom.xml 

Base directory Variable

In order to make life easier when these file locations need to be specified in the install.xml, we can befine a variable RESOURCEROOT that will point to the src/main/izpack folder

File Layout
<installation version="5.0">
  <variables>
    <variable name="RESOURCEROOT" value="src/main/izpack"/>
  </variables>
 </installation>

We will discuss variables in more detail in the Variables Section.

Another, more Maven-centric approach is pulling in the base directory (and other useful values) directly from a Maven property defined in the POM and accessing them by expressions of kind @{property.key} in install.xml, as described in Properties.