Once generated or modified, your Ant scripts can be executed without launching the IDE; this is called the Headless mode. To run the Ant script, you simply invoke the antRunner application, passing the Ant file as argument.
echo off
setlocal
set ECLIPSE=d:\IBM\SDP75
set WORKSPACE=d:\WorkspaceANT
set BUILDFILE=d:\INPUTMSG.xml
set JAVA_HOME=%ECLIPSE%\jdk\jre
set PATH=%JAVA_HOME%\bin;%PATH%
set CLASSPATH=%JAVA_HOME%\lib;%CLASSPATH%
set EQUINOXJAR=%ECLIPSE%\plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
java -showversion -Xms50M -Xmx350M -XX:MaxPermSize=128m -cp "%EQUINOXJAR%"
org.eclipse.core.launcher.Main -data %WORKSPACE% -application org.eclipse.ant.core.antRunner -
buildfile %BUILDFILE%
Linux: Create a antgenerate.sh file (or use the example in ../IBM/IBMIMShared/plugins/com.ibm.j2c.cheatsheet.content):
#!/bin/bash
ECLIPSE="/opt/IBM/SDP/"
WORKSPACE="/home/temp/workspace/ant"
BUILDFILE="/home/temp/antscript/Customer.xml"
JAVA_HOME="$ECLIPSE/jdk"
JAVA="$JAVA_HOME/jre/bin/java"
EQUINOXJAR="$ECLIPSE/plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar"
PATH="$PATH:$JAVA_HOME/bin"
export PATH
CLASSPATH="$CLASSPATH:$JAVA_HOME/lib"
export CLASSPATH
"$JAVA" -cp "$EQUINOXJAR" org.eclipse.core.launcher.Main -os linux -ws gtk -data "$WORKSPACE" -application org.eclipse.ant.core.antRunner -buildfile "$BUILDFILE"
Where: Make sure that the org.eclipse.equinox.launcher JAR file exists.
You can modify the variables in the batch file to fit your environment:
<target name="Init1">
<property name="debug" value="true"/>
<property name="project1" value="Test"/>
<property name="j2c.runtime" value="WebSphere Application Server v7.0"/>
<property name="ra.project" value="cicseci7102"/>
<property name="ra.runtime" value="WebSphere Application Server v7.0"/>
<property name="ra.file" value="Cannot Locate RAR" />
</target>
importResourceAdapter1:
[j2c:importResourceAdapter] Creating connector project cicseci6022 ...done
J2CBeanGeneration1:
[j2c:generateService] Generate service:
[j2c:generateService] Registry returned Resource Adapter descriptor: null
[j2c:generateService] Wait for Resource Adapter registry processing ...
[j2c:generateService] Done after 120 seconds.
[j2c:generateService] Registry returned Resource Adapter descriptor: null
[j2c:generateService] Could not retrieve a Resource Adapter for project: cicseci
6022
[j2c:generateService] Generate service ...failed
BUILD SUCCESSFUL
This is because the system times out
during the resource adapter import.Workarounds