ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kaufman <mike.kauf...@bea.com>
Subject RE: Setting environment variables for a javac task
Date Fri, 22 Feb 2002 19:03:38 GMT

FYI.  

The suggestion of passing in JAVA_HOME as params in an antcall does not
override environment settings.  

However, I think I have found a solution. You can override environment
settings for javac by recursively executing ant via an <exec> tag and
setting the environment variables for that <exec> tag.  For example: 

<target name="build">
 <exec executable="./../ant/bin/ant.bat" dir=".">
      <env key="JAVA_HOME" value="${env.JDK_14}"/>
      <arg value="build_recursed"/>
 </exec>
</target>

Why I didn't think of that sooner, I don't know!

Thanks for the help.

Mike


> 
> --- Mike Kaufman <mike.kaufman@bea.com> wrote:
> > > I need to have a single ant target do multiple javac tasks, 
> > > some of which use JDK 1.4, others that use JDK 1.3.  Setting 
> > > the "build.compiler" property did not seem to work for me.  
> 
> I think you'd need to break your single target into separate 
> targets --
> one for the 1.3 stuff and one for the 1.4 -- then use 
> <antcall>, passing
> build.compiler (or maybe java.home? -- I only have 1.3 and jikes, so I
> can't say for sure) as a <param>.
> 





--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message