You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sr...@timeinc.com on 2006/01/25 21:03:31 UTC
Using 2 versions of JAVA_HOME through one build script
I have the following build.xml file for doing the build. I need to
switch my java_home every time to do two versions of weblogic builds.
Instead of setting through system control panel JAVA_HOME , I want to
set it through ant script.
<project name="ejblink" default="all" basedir=".">
<!-- set global properties for this build -->
<property name="source" value="."/>
<property name="build" value="${source}/build"/>
<property name="dist" value="${source}/dist"/>
<property name="ejbc_jar_file" value="OMSQueueEngine.jar" />
<property name="war_file" value="OMSQueueEngine.war" />
<property name="ear_file" value="OMSQueueEngine.ear" />
<property name="ANT_HOME" value="C:\apache-ant-1.6.2" />
<path id="base.path">
<fileset dir="${ANT_HOME}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<echo message="${ANT_HOME}" />
<path id="classpath.server">
<path refid="base.path"/>
<pathelement location="lib/weblogic.jar"/>
<pathelement location="lib/webservices.jar"/>
<pathelement location="lib/xerces.jar"/>
<pathelement location="lib/ejbgen.jar"/>
</path>
<taskdef name="wlappc" classname="weblogic.ant.taskdefs.j2ee.Appc"
classpathref="classpath.server" />
<taskdef name="servicegen"
classname="weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask"
classpathref="classpath.server" />
<target name="all" depends="clean, ear"/>
<target name="clean">
<delete dir="ejbcgen" />
<delete dir="${build}" />
<delete dir="${dist}" />
<delete file="${war_file}"/>
<delete file="dist/${ear_file}"/>
</target>
<target name="ear" depends="build-ejb">
<delete dir="${build}" />
<mkdir dir="${build}" />
<copy todir="${build}" file="${dist}/${ejbc_jar_file}"/>
<servicegen
destEar="dist/${ear_file}"
warName="${war_file}"
contextURI="OMS">
<service
ejbJar="${build}/${ejbc_jar_file}"
targetNamespace="http://localhost:7011/OMS/OMSQueueEngine"
serviceName="OMSQueueEngine"
serviceURI="/OMSQueueEngine"
generateTypes="True"
expandMethods="True" >
</service>
<classpath refid="classpath.server"/>
</servicegen>
</target>
<target name="build-ejb">
<delete dir="${build}" />
<delete dir="${dist}" />
<mkdir dir="${build}" />
<mkdir dir="${dist}"/>
<javac source="1.5" srcdir="src" excludes="Client.java"
destdir="${build}">
<classpath refid="classpath.server"/>
</javac>
<copy todir="${build}/META-INF" >
<fileset dir="." >
<include name="*.xml"/>
</fileset>
</copy>
<jar jarfile="${dist}/${ejbc_jar_file}"
basedir="${build}"
update="yes"/>
<wlappc debug="${debug}"
source="${dist}/${ejbc_jar_file}"
/>
</target>
</project>
Re: Using 2 versions of JAVA_HOME through one build script
Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 25 Jan 2006, Srikrishna Parthasarathy
<Sr...@timeinc.com> wrote:
> I have the following build.xml file for doing the build. I need to
> switch my java_home every time to do two versions of weblogic
> builds. Instead of setting through system control panel JAVA_HOME ,
> I want to set it through ant script.
I'm afraid you can't, unless the tasks you use support setting it in
some way. The only way I'd see is using <exec> (which allows
re-setting environment variables) instead of the custom tasks.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org