IntelliJ Java IDE
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT Script Example for Websphere Application Server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "ANT Script Example for Websphere Application Server" Watch "ANT Script Example for Websphere Application Server" New topic
Author

ANT Script Example for Websphere Application Server

Madhu Ramesh
Greenhorn

Joined: Mar 02, 2004
Posts: 5
Hai,
I need ANT Script example which is compatible for websphere Application Server5.0.Presently iam working on that, but it is not generating Stubs & Skeltons for EJBs.Any one help me whats the wrong in my Script, my script is like this:
<!-- build file -->
<project name="RDRBuild" default="all" basedir=".">
<property file="./setup_rdr.properties"/>

<path id="project.class.path">
<fileset dir="${RDR_LIB}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
</path>

<path id="project.wardependency.path">
<fileset dir="${RDR_LIB}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
<fileset dir="${EARS_OUT}">
<include name="rdrEJB.jar"/>
</fileset>
</path>

<target name="compile" depends="prepare, compileAll"/>
<!-- Create the out directory to place the generated class files -->
<target name="prepare">
<mkdir dir="${JAVA_OUT}"/>
<mkdir dir="${WAR_JAVA_OUT}"/>
<mkdir dir="${EARS_OUT}"/>
<mkdir dir="${JAR_SOURCE}"/>
</target>
<target name="compileAll" depends="rdrCommon,rdrDmt,rdrEJB"/>

<target name="rdrCommon">
<javac
optimize="on"
debug="on"
destdir="${JAVA_OUT}"
includes="**">

<classpath refid="project.class.path"/>
<src path="${SOURCES_RDR}/common"/>
</javac>

</target>
<target name="rdrDmt">
<javac
optimize="on"
debug="on"
destdir="${JAVA_OUT}"
includes="**">

<classpath refid="project.class.path"/>
<src path="${SOURCES_RDR}/EJBModule/rsch/rdr/dmt"/>
</javac>

</target>
<!-- added for on the fly stub generation -->
<target name = "rdrEJB" >
<javac
debug = "off"
optimize = "on" deprecation = "on" destdir = "${JAVA_OUT}" includes = "**">
<classpath refid = "project.class.path" />
<src path="${SOURCES_RDR}/EJBModule/rsch/rdr/session"/>
</javac>
</target>


<target name="ejbJar" depends="compile">
<property name="websphere.home" value="C:/Program Files/IBM/WebSphere Studio"/>
<ejbjar srcdir="${JAVA_OUT}/rsch/rdr/session" descriptordir="${SOURCES_RDR}/EJBModule/META-INF" classpath="${WEBSPHERE_HOME}\bin">
<include name="*-ejb-jar.xml"/>
<support dir="${SOURCES_RDR}/EJBModule/META-INF">
<include name="ibm-ejb-jar-*.xmi"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/entities">
<include name="**/*.class"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/util">
<include name="**/*.class"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/dmt">
<include name="**/*.class"/>
</support>

<!--
<websphere ejbdeploy="true" rebuild="true" codegen="false" oldCMP="false" tempdir="/tmp" destdir="${JAR_SOURCE}">
<echo>After Directory creation</echo>
<wasclasspath>
<pathelement location="${RDR_LIB}/boot.jar"/>
<pathelement location="${RDR_LIB}/batch.jar"/>
<pathelement location="${RDR_LIB}/xerces.jar"/>
<pathelement location="${RDR_LIB}/ivjejb35.jar"/>
<pathelement location="${RDR_LIB}/j2ee.jar"/>
<pathelement location="${RDR_LIB}/vaprt.jar"/>
</wasclasspath>
<classpath>
<path refid="project.class.path"/>
</classpath>
-->
<websphere trace="true" ejbdeploy="true" oldCMP="false" destdir="${JAR_SOURCE}" tempdir="${JAR_SOURCE}/temp" novalidate="true">
<classpath refid="project.class.path"/>
<wasclasspath>
<pathelement location="${RDR_LIB}/boot.jar"/>
<pathelement location="${RDR_LIB}/batch.jar"/>
<pathelement location="${RDR_LIB}/xerces.jar"/>
<pathelement location="${RDR_LIB}/ivjejb35.jar"/>
<pathelement location="${RDR_LIB}/j2ee.jar"/>
<pathelement location="${RDR_LIB}/vaprt.jar"/>
<pathelement location="${RDR_LIB}/rt.jar"/>
</wasclasspath>
</websphere>


<dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
location="${lib}/dtd/ejb-jar_1_1.dtd"/>
</ejbjar>

</target>

<target name="clean">
<delete dir="${JAVA_OUT}"/>
<delete dir="${JARS_OUT}"/>
</target>
<target name="compile_war" depends="compileForms,compileActions,compileManager,compileSearch,compileWebUtil"/>
<target name="compileForms">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rdrweb/forms/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileActions">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/workflowhandler/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileManager">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/manager/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileSearch">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/search/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>

<target name="compileWebUtil">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/util/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="war" depends="compile_war">

<echo> Ant Msg: Building War </echo>

<war jarfile="${EARS_OUT}/rdrWeb.war" webxml="${JAVA_SOURCES_WEB}/WEB-INF/web.xml">
<zipfileset dir="${JAVA_SOURCES_WEB}/WEB-INF" includes="struts-config.xml,*.tld" prefix="/WEB-INF"/>
<zipfileset dir="${WAS_SOURCE}" includes="ibm-web-ext.xmi,ibm-web-bnd.xmi" prefix="/WEB-INF"/>
<zipfileset dir="../JavaSource/config" includes="*.cfg,*.dtd,*.ini,*.xml" prefix="/WEB-INF/config"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/WEB-INF" includes="MANIFEST.MF" prefix="/META-INF"/>
<zipfileset dir="${RDR_LIB}" includes="struts.jar" prefix="/WEB-INF/lib"/>
<zipfileset dir="${WAR_JAVA_OUT}/rdrweb/forms" includes="*.class" prefix="/WEB-INF/rdrweb/forms"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/dmt" includes="*.class" prefix="/WEB-INF/rsch/rdr/dmt"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/manager" includes="*.class" prefix="/WEB-INF/rsch/rdr/manager"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/search" includes="*.class" prefix="/WEB-INF/rsch/rdr/search"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util" includes="*.class" prefix="/WEB-INF/rsch/rdr/util"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util/cache" includes="*.class" prefix="/WEB-INF/rsch/rdr/util/cache"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util/log" includes="*.class" prefix="/WEB-INF/rsch/rdr/util/log"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/js" includes="*.gif,*.js,*.css" prefix="/js"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/images" includes="*.gif" prefix="/images"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/jsp" includes="*.jsp,*.html,*.xml"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/js" includes="*.css" prefix="/logs"/>
</war>
</target>
<target name="cleaning">
<delete dir="${WAR_JAVA_OUT}"/>
<delete dir="${JAVA_OUT}"/>
</target>
<target name="ejbEar" depends="ejbJar,war,cleaning">
<ear jarfile="${EARS_OUT}/rdr.ear" appxml="${WAS_SOURCE}/application.xml">
<zipfileset dir="${WAS_SOURCE}" includes="ibm-application-ext.xmi,MANIFEST.MF" prefix="META-INF"/>
<zipfileset dir="${RDR_LIB}" includes="classes12.zip,dal.jar,log4j-1.2.8.jar,rschcommons.jar,xmlparserv2.jar"/>
<fileset dir="${EARS_OUT}" includes="*.jar"/>
<fileset dir="${EARS_OUT}" includes="*.war"/>
</ear>

<echo> Sucessfully build the ear file. </echo>
</target>

</project>
Thanks in advance
rgds,
Madhu Ramesh Kumar.
Madhu Ramesh
Greenhorn

Joined: Mar 02, 2004
Posts: 5
Please help me..any one..
Iam not able to compile EJBS...
rgds,
Madhu Ramesh
Chandra Peri
Ranch Hand

Joined: Sep 18, 2002
Posts: 46
<target name="ejbcompile">
<mkdir dir="${my.jardir}"/>
<jar destfile="${my.jardir}/xx${my.jarfile}" manifest="${idlcore.src}/META-INF/MANIFEST.MF">
<fileset dir="${root.dir}/${build}">
<include name="${components.loc}/my/**"/>
</fileset>
<fileset dir="${my.src}">
<include name="META-INF/*"/>
</fileset>
</jar>
<exec dir="${idlcore.jardir}" executable="${ejbc}">
<arg line="xx${my.jarfile}"/>
<arg line="wastemp"/>
<arg line="${my.jarfile}"/>
<arg line="-cp"/>
<arg line="${ejbcompile.cp}${path.separator}${root.dir}/${dist}/${core.jarfile}${path.separator}${root.dir}/${dist}/${some.jarfile}"/>
</exec>
<copy file="${my.jardir}/${my.jarfile}" todir="${root.dir}/${dist}"/>
<delete dir="${my.jardir}"/>
</target>
In the above script, ejbc=C:/Progra~1/IBM/WebSph~1/bin/ejbdeploy.bat; this is an excerpt from my script, to give u an idea.
First I create a jar file with the ejbs, then I pass the jar file to ejbcompile.bat, which produces a jar file with stubs.
Madhu Ramesh
Greenhorn

Joined: Mar 02, 2004
Posts: 5
Thanx yaar...
bob morkos
Ranch Hand

Joined: Oct 06, 2003
Posts: 56
Could you provide the property file:
<property file="./setup_rdr.properties"/>
Thanks in advance.
Originally posted by Madhu Ramesh:
Hai,
I need ANT Script example which is compatible for websphere Application Server5.0.Presently iam working on that, but it is not generating Stubs & Skeltons for EJBs.Any one help me whats the wrong in my Script, my script is like this:
<!-- build file -->
<project name="RDRBuild" default="all" basedir=".">
<property file="./setup_rdr.properties"/>

<path id="project.class.path">
<fileset dir="${RDR_LIB}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
</path>

<path id="project.wardependency.path">
<fileset dir="${RDR_LIB}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
<fileset dir="${EARS_OUT}">
<include name="rdrEJB.jar"/>
</fileset>
</path>

<target name="compile" depends="prepare, compileAll"/>
<!-- Create the out directory to place the generated class files -->
<target name="prepare">
<mkdir dir="${JAVA_OUT}"/>
<mkdir dir="${WAR_JAVA_OUT}"/>
<mkdir dir="${EARS_OUT}"/>
<mkdir dir="${JAR_SOURCE}"/>
</target>
<target name="compileAll" depends="rdrCommon,rdrDmt,rdrEJB"/>

<target name="rdrCommon">
<javac
optimize="on"
debug="on"
destdir="${JAVA_OUT}"
includes="**">

<classpath refid="project.class.path"/>
<src path="${SOURCES_RDR}/common"/>
</javac>

</target>
<target name="rdrDmt">
<javac
optimize="on"
debug="on"
destdir="${JAVA_OUT}"
includes="**">

<classpath refid="project.class.path"/>
<src path="${SOURCES_RDR}/EJBModule/rsch/rdr/dmt"/>
</javac>

</target>
<!-- added for on the fly stub generation -->
<target name = "rdrEJB" >
<javac
debug = "off"
optimize = "on" deprecation = "on" destdir = "${JAVA_OUT}" includes = "**">
<classpath refid = "project.class.path" />
<src path="${SOURCES_RDR}/EJBModule/rsch/rdr/session"/>
</javac>
</target>


<target name="ejbJar" depends="compile">
<property name="websphere.home" value="C:/Program Files/IBM/WebSphere Studio"/>
<ejbjar srcdir="${JAVA_OUT}/rsch/rdr/session" descriptordir="${SOURCES_RDR}/EJBModule/META-INF" classpath="${WEBSPHERE_HOME}\bin">
<include name="*-ejb-jar.xml"/>
<support dir="${SOURCES_RDR}/EJBModule/META-INF">
<include name="ibm-ejb-jar-*.xmi"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/entities">
<include name="**/*.class"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/util">
<include name="**/*.class"/>
</support>
<support dir="${JAVA_OUT}/rsch/rdr/dmt">
<include name="**/*.class"/>
</support>

<!--
<websphere ejbdeploy="true" rebuild="true" codegen="false" oldCMP="false" tempdir="/tmp" destdir="${JAR_SOURCE}">
<echo>After Directory creation</echo>
<wasclasspath>
<pathelement location="${RDR_LIB}/boot.jar"/>
<pathelement location="${RDR_LIB}/batch.jar"/>
<pathelement location="${RDR_LIB}/xerces.jar"/>
<pathelement location="${RDR_LIB}/ivjejb35.jar"/>
<pathelement location="${RDR_LIB}/j2ee.jar"/>
<pathelement location="${RDR_LIB}/vaprt.jar"/>
</wasclasspath>
<classpath>
<path refid="project.class.path"/>
</classpath>
-->
<websphere trace="true" ejbdeploy="true" oldCMP="false" destdir="${JAR_SOURCE}" tempdir="${JAR_SOURCE}/temp" novalidate="true">
<classpath refid="project.class.path"/>
<wasclasspath>
<pathelement location="${RDR_LIB}/boot.jar"/>
<pathelement location="${RDR_LIB}/batch.jar"/>
<pathelement location="${RDR_LIB}/xerces.jar"/>
<pathelement location="${RDR_LIB}/ivjejb35.jar"/>
<pathelement location="${RDR_LIB}/j2ee.jar"/>
<pathelement location="${RDR_LIB}/vaprt.jar"/>
<pathelement location="${RDR_LIB}/rt.jar"/>
</wasclasspath>
</websphere>


<dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
location="${lib}/dtd/ejb-jar_1_1.dtd"/>
</ejbjar>

</target>

<target name="clean">
<delete dir="${JAVA_OUT}"/>
<delete dir="${JARS_OUT}"/>
</target>
<target name="compile_war" depends="compileForms,compileActions,compileManager,compileSearch,compileWebUtil"/>
<target name="compileForms">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rdrweb/forms/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileActions">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/workflowhandler/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileManager">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/manager/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="compileSearch">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/search/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>

<target name="compileWebUtil">
<javac
optimize="on"
debug="on"
destdir="${WAR_JAVA_OUT}"
includes="rsch/rdr/util/**">
<classpath refid="project.wardependency.path"/>
<src path="${JAVA_SOURCES_WEB}"/>
</javac>
</target>
<target name="war" depends="compile_war">

<echo> Ant Msg: Building War </echo>

<war jarfile="${EARS_OUT}/rdrWeb.war" webxml="${JAVA_SOURCES_WEB}/WEB-INF/web.xml">
<zipfileset dir="${JAVA_SOURCES_WEB}/WEB-INF" includes="struts-config.xml,*.tld" prefix="/WEB-INF"/>
<zipfileset dir="${WAS_SOURCE}" includes="ibm-web-ext.xmi,ibm-web-bnd.xmi" prefix="/WEB-INF"/>
<zipfileset dir="../JavaSource/config" includes="*.cfg,*.dtd,*.ini,*.xml" prefix="/WEB-INF/config"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/WEB-INF" includes="MANIFEST.MF" prefix="/META-INF"/>
<zipfileset dir="${RDR_LIB}" includes="struts.jar" prefix="/WEB-INF/lib"/>
<zipfileset dir="${WAR_JAVA_OUT}/rdrweb/forms" includes="*.class" prefix="/WEB-INF/rdrweb/forms"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/dmt" includes="*.class" prefix="/WEB-INF/rsch/rdr/dmt"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/manager" includes="*.class" prefix="/WEB-INF/rsch/rdr/manager"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/search" includes="*.class" prefix="/WEB-INF/rsch/rdr/search"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util" includes="*.class" prefix="/WEB-INF/rsch/rdr/util"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util/cache" includes="*.class" prefix="/WEB-INF/rsch/rdr/util/cache"/>
<zipfileset dir="${WAR_JAVA_OUT}/rsch/rdr/util/log" includes="*.class" prefix="/WEB-INF/rsch/rdr/util/log"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/js" includes="*.gif,*.js,*.css" prefix="/js"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/images" includes="*.gif" prefix="/images"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/jsp" includes="*.jsp,*.html,*.xml"/>
<zipfileset dir="${JAVA_SOURCES_WEB}/js" includes="*.css" prefix="/logs"/>
</war>
</target>
<target name="cleaning">
<delete dir="${WAR_JAVA_OUT}"/>
<delete dir="${JAVA_OUT}"/>
</target>
<target name="ejbEar" depends="ejbJar,war,cleaning">
<ear jarfile="${EARS_OUT}/rdr.ear" appxml="${WAS_SOURCE}/application.xml">
<zipfileset dir="${WAS_SOURCE}" includes="ibm-application-ext.xmi,MANIFEST.MF" prefix="META-INF"/>
<zipfileset dir="${RDR_LIB}" includes="classes12.zip,dal.jar,log4j-1.2.8.jar,rschcommons.jar,xmlparserv2.jar"/>
<fileset dir="${EARS_OUT}" includes="*.jar"/>
<fileset dir="${EARS_OUT}" includes="*.war"/>
</ear>

<echo> Sucessfully build the ear file. </echo>
</target>

</project>
Thanks in advance
rgds,
Madhu Ramesh Kumar.
 
 
subject: ANT Script Example for Websphere Application Server
 
Threads others viewed
creating long classpath?
Is this the correct way to compile code that uses classes in another jar file
Error in connecting client application with EJB deployed in JBOSS
compilation errors using ant
Why classpath refid (newbie)?
developer file tools