>>>>> "AY" == Arion Yu <[EMAIL PROTECTED]> 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