ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Error building struts
Date Fri, 28 Jul 2000 09:40:08 GMT
>>>>> "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

  <property name="servlet.jar" value="../${servlet.jar}:${servlet.jar}"> 

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 name="subrelative" depends="check" if="is.relative">
    <property name="servlet.jar" value="../${servlet.jar}"> 

<target name="subabsolute" depends="check" unless="is.relative">

<target name="sub" depends="subrelative,subabsolute" />


View raw message