Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ant and external jars relative to an 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. I do not want to include the external jars in my project - just reference them. It seemed pretty straightforward but I can't seem to get it to work under XCode. I have had some success from the Terminal though. What's the recommended 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. I also tried using FileSets.

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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.