You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stephen Nitz <gr...@yahoo.de> on 2004/01/27 23:55:32 UTC
available file not available
Hi!
I'm new to ant, java and linux so maybe I'm asking
something very obvious.
I have installed ant 1.5.4 and 1.6 and the problem
arises with both.
(JDK j2sdk1.4.1_02, eclipse 3.0)
I tried to modify an existing build.xml (and
build.properties) but the build fails miserably
already when checking the existence of files.
I am sure the given file exists and its access rights
should be ok, too.
The strange behaviour is the following:
"available" (in the checkRequiredFile target) works
when passing the path of the file as a param
"available" fails when passing a variable containing
the path of the file as a param
These are experpts of my build.xml :
------------------------------------------- start
snippet
<target name="verifyPreconditions"
description="Verify all jars exist">
<echo>servlet.jar = ${servlet.jar}</echo>
<echo>servlet.jar =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar</echo>
<antcall target="checkRequiredFile">
<param name="file"
value="/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar"/>
<param name="fail.message" value="basic test
failed"/>
</antcall>
99: <antcall target="checkRequiredFile">
<param name="file" value="${servlet.jar}"/>
<param name="fail.message" value="basic test
failed"/>
</antcall>
...
<target name="checkRequiredFile">
<echo>file = ${file}</echo>
<available file="${file}"
property="requirement.satisfied"/>
159: <antcall target="checkRequired.fail"/>
</target>
<target name="checkRequired.fail"
unless="requirement.satisfied">
<echo>failed file = ${file}</echo>
164: <fail message="${fail.message}"/>
</target>
...
------------------------------------------- end
snippet
I get the following output :
------------------------------------------- start
snippet
Buildfile: build.xml
verifyPreconditions:
[echo] servlet.jar =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar
[echo] servlet.jar =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar
checkRequiredFile:
[echo] file =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar
checkRequired.fail:
checkRequiredFile:
[echo] file =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar
checkRequired.fail:
[echo] failed file =
/opt/Java/jakarta/jakarta-tomcat-5.0.16/common/lib/servlet-api.jar
BUILD FAILED
/home/snitz/Projects/eclipse/carddemo/build.xml:99:
Following error occured while executing this line
/home/snitz/Projects/eclipse/carddemo/build.xml:159:
Following error occured while executing this line
/home/snitz/Projects/eclipse/carddemo/build.xml:164:
basic test failed
------------------------------------------- end
snippet
I really can't figure out why it fails
Your help is appreciated
Thanks,
Stephen
________________________________________________________________________
BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: available file not available
Posted by Bill Rich <bi...@attglobal.net>.
You probably need to apply the Trim filter before trying to use the incoming string. You
will find it in the manual under FilterChains and FilterReaders->TokenFilter->Trim.
Bill
-----Original Message-----
From: Stephen Nitz [mailto:greenwindows101@yahoo.de]
Sent: Wednesday, January 28, 2004 4:58 AM
To: Ant Users List
Subject: Re: available file not available
> The strange behaviour is the following:
> "available" (in the checkRequiredFile target) works
> when passing the path of the file as a param
> "available" fails when passing a variable containing
> the path of the file as a param
Found the problem:
trailing spaces of the variable definition in the
build.properties file make the difference!
This sort of errors should no longer happen in the
21st century!
________________________________________________________________________
BT Yahoo! Broadband - Free modem offer, sign up online today and save £80
http://btyahoo.yahoo.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: available file not available
Posted by Stephen Nitz <gr...@yahoo.de>.
> The strange behaviour is the following:
> "available" (in the checkRequiredFile target) works
> when passing the path of the file as a param
> "available" fails when passing a variable containing
> the path of the file as a param
Found the problem:
trailing spaces of the variable definition in the
build.properties file make the difference!
This sort of errors should no longer happen in the
21st century!
________________________________________________________________________
BT Yahoo! Broadband - Free modem offer, sign up online today and save £80 http://btyahoo.yahoo.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org