Hi,
-------- Original-Nachricht --------
Datum: Fri, 18 Aug 2006 11:18:40 -0400
Von: Robert La Ferla <[EMAIL PROTECTED]>
An: Ant Users List <user@ant.apache.org>
Betreff: classpath from external jars relative to environment variable

> 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.
>
Wrong, property values expand other property values (if the props are defined).
 
> e.g.
>   <property name="myclasspath" value=".:${env. MYPROJECT}/endorsed/ 
> xercesImpl.jar:${env. MYPROJECT}/endorsed/jdom.jar"/>
> 
You type env. MYPROJECT

should be env.MYPROJECT

without space between env. and MYPROJECT


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

better

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

Regards,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to