I have been working on a project with IIB (IBM Integration Bus). If you are like me, you want to automate all those pesky build tasks. In IIB, I needed to package and build my project (BAR).
I investigated scripting the build using the mqsipackagebar command . I noticed at the bottom a description of using it with ANT.
I’ve used ANT in a few projects (in combination with Maven). I took the script as a starting point, added the jar files and property files (based on configuring environments without IIB). I configured the maven-antrun-plugin in order to integrate within my parent project’s maven build.
Here is some sample code for you, I hope it helps you all get started:
<project default="buildiib"> | |
<target name="buildiib"> | |
<echo message="Beginning the Execution of the IIB Builder" /> | |
<property environment="env" /> | |
<echo message="JAVA_HOME is = ${java.home}" /> | |
<echo message="Base Directory for execution of project is = ${basedir}" /> | |
<echo message="env.CLASSPATH = ${env.CLASSPATH}" /> | |
<!-- Executes specific IIB class --> | |
<java classname="com.ibm.broker.config.appdev.FlowRendererBAR" failonerror="true" fork="true" newenvironment="true"> | |
<arg line="-w ./src/main/pipeline/" /> | |
<arg line="-a testflow.bar" /> | |
<arg line="-o filePrint.msgflow" /> | |
<arg line="-y Myapp1" /> | |
<arg line="-v test.log" /> | |
<!-- Sets the Classpath --> | |
<classpath> | |
<pathelement location="." /> | |
<fileset dir="./src/main/iib/messages"> | |
<include name="*.jar" /> | |
</fileset> | |
<fileset dir="./src/main/iib/server_classes"> | |
<include name="*.jar" /> | |
</fileset> | |
<fileset dir="./src/main/iib/classes"> | |
<include name="*.jar" /> | |
</fileset> | |
<fileset dir="./src/main/iib/jetty"> | |
<include name="*.jar" /> | |
</fileset> | |
</classpath> | |
</java> | |
<echo message="Ending the Execution of the IIB Builder" /> | |
</target> | |
</project> |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>mydemo</groupId> | |
<artifactId>demo</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>demo.barbuilder</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<artifactId>maven-antrun-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>build-iib-project</id> | |
<phase>package</phase> | |
<goals> | |
<goal>run</goal> | |
</goals> | |
<configuration> | |
<tasks> | |
<ant antfile="build.xml" target="buildiib"> | |
</ant> | |
</tasks> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<!-- Configured Here for those that do not have .m2/settings.xml set to point to maven repository--> | |
<repositories> | |
<repository> | |
<id>maven online</id> | |
<name>maven repository</name> | |
<url>https://repo1.maven.org/maven2/</url> | |
</repository> | |
</repositories> | |
</project> |