How to Integrate InstallBuilder with Apache Ant and Apache Maven

Published on

Apache Ant and Apache Maven are two of the most popular tools for building projects. This article explains how to integrate InstallBuilder with these two tools.

If you use Apache Ant for building your projects, you can include the following section for building your binary installer.

build.xml

<project name="MyProject">
    <exec executable="/home/bitrock/installbuilder-6.2.4/bin/builder">
        <arg line="build /home/bitrock/installbuilder-6.2.4/projects/demo.xml linux"></arg>
    </exec>
</project>

Where the executable tag sets the path of the builder program and the arg tag defines the build process, the location of your InstallBuilder project file and the target platform.

During the build process, you will see something similar to:

Buildfile: build.xml
     [exec]  Building Demo Project linux
     [exec]  0% ______________ 50% ______________ 100%
     [exec]  #########################################
     [exec]

BUILD SUCCESSFULTotal time: 1 second

If you use Apache Maven for building your projects, you can find below an example of a pom.xml file to build a demo project.

pom.xml

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1</version>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>/home/bitrock/installbuilder-6.2.4/bin/builder</executable>
          <arguments>
            <argument>build</argument>
            <argument>/home/bitrock/installbuilder-6.2.4/projects/demo.xml</argument>
            <argument>linux</argument>
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

The executable tag contains the path to the builder program and the argument tags describe the build process, the location of your InstallBuilder project file and the platform target.

You can launch the build using the following command:

$ mvn exec:exec

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.mycompany.app:my-app:jar:1
[INFO]    task-segment: [exec:exec]
[INFO] ------------------------------------------------------------------------
[INFO] [exec:exec {execution: default-cli}]
[INFO]  Building Demo Project linux
[INFO]  0% ______________ 50% ______________ 100%
[INFO]  #########################################
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu Nov 05 11:47:09 CET 2009
[INFO] Final Memory: 3M/64M
[INFO] ------------------------------------------------------------------------