ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arion Yu <>
Subject Finding the absolute path from relative (was Re: Error building struts)
Date Mon, 31 Jul 2000 07:49:23 GMT

Is there anyway to resolve the $servlet.jar from absolute/relative to

Should the classpath be separated with : (Unix style) or ; (Windows style)
or both are acceptable?

For the second approach, would ./ do the same work as sub/../ ?



Stefan Bodewig wrote:

> >>>>> "AY" == Arion Yu <> writes:
>  AY> The problem is the property sevlet.jar. The parameter can be set
>  AY> from the environment. The value may indicate a relative path (eg
>  AY> "../jakarta-servletapi/lib/servlet.jar") or absolute path (eg
>  AY> c:\servletapi\servlet.jar)
>  AY> What I want to do is, for the first case:
>  AY> <ant>
>  AY>   <property name="servlet.jar" value="../${servlet.jar}">
>  AY> </ant>
>  AY> and untoucth the value for the second case.
>  AY> What should I do?
> I'm afraid there is no easy solution that will always work. If the
> property is only going to be used in CLASSPATH constructs, you could
> just simply say
> <ant>
>   <property name="servlet.jar" value="../${servlet.jar}:${servlet.jar}">
> </ant>
> the non existing part is going to be thrown out by javac, java or
> whatever you are going to use.
> A more general - and more ugly - solution would be
> <target name="check">
>   <available property="is.relative" file="sub/../${servlet.jar}" />
> </target>
> <target name="subrelative" depends="check" if="is.relative">
>   <ant>
>     <property name="servlet.jar" value="../${servlet.jar}">
>   </ant>
> </target>
> <target name="subabsolute" depends="check" unless="is.relative">
>   <ant>
> </target>
> <target name="sub" depends="subrelative,subabsolute" />
> Stefan

[This email and any files transmitted with it are confidential and may
contain information that is legally privileged. They are intended solely for
the addressee(s). Access to this email by anyone else is unauthorized. If
you are not the intended recipient, please delete it and notify the sender
by email immediately; you should not copy or use it for any purpose, nor
disclose its contents to any other person. Thank you.]

View raw message