ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert La Ferla <robertlafe...@comcast.net>
Subject classpath from external jars relative to environment variable
Date Fri, 18 Aug 2006 15:18:40 GMT
I have several external jars that are located relative to a directory  
specified by an environment variable $MYPROJECT.   I need to  
construct a classpath within my build.xml so that javac can compile  
my project.  It seemed pretty straightforward but I can't seem to get  
it to work.  What's the best way to do this?

Here's my compile target:

     <target name="compile" description="Compile code">
         <mkdir dir="${bin}"/>
         <mkdir dir="${lib}"/>
         <javac srcdir="${src}" destdir="${bin}"
                source="1.5" target="1.5"
                includeAntRuntime="no"
			   classpath="${myclasspath}"
			   debug="${compile.debug}">
		</javac>
     </target>


One thing I discovered is that a "property" value does not evaluate/ 
expand other environmental variables.  It expects a constant.

e.g.
  <property name="myclasspath" value=".:${env. MYPROJECT}/endorsed/ 
xercesImpl.jar:${env. MYPROJECT}/endorsed/jdom.jar"/>

I also tried :

<path id="myclasspath">
   <pathelement path=".:${env. MYPROJECT}/endorsed/xercesImpl.jar:$ 
{env. MYPROJECT}/endorsed/jdom.jar"/>
</path>

and then used classpathref="myclasspath" in the javac task but that  
didn't work either.

What am I missing?


SYSTEM/VERSION INFO

Mac OS X Intel 10.4.7 and XCode 2.3

% ant -version
Apache Ant version 1.6.5 compiled on April 11 2006
% uname -a
Darwin localhost 8.7.1 Darwin Kernel Version 8.7.1: Wed Jun  7  
16:19:56 PDT 2006; root:xnu-792.9.72.obj~2/RELEASE_I386 i386 i386




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


Mime
View raw message