ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Shott <>
Subject Re: Need help in build.xml file...
Date Sat, 27 Dec 2008 02:01:36 GMT

I think that you aren't doing everything that you think you are doing in 
this snippet.  In particular, it appears as if nothing ever sets the 
isaFile property.  And, because your printError target depends on the 
isaFile property being set, you will never get your error message.

If I do a little guessing, I think that you <condition> task should be:

 <condition property="isaFile">
  <isset property="present" /> 
  <isset property="isaDir" /> 

Instead of:

>  <condition property="isaDir">
>  <and>
>   <isset property="present" /> 
>  <not>
>   <isset property="isaFile" /> 
>   </not>
>   </and>
>   </condition>
In other words, I think that you want to set the isaFile property if ${caratsharp.dir} exists
but is NOT a directory, correct?

And, I think that you need to check for 3 things:

1. ${caratsharp.dir} doesn't exist at all ... that's an error.
2. ${carachsarp.dir} exists, but is not a directory (that is, it's a regular file) .... that's
an error condition, too, isn't it?
3. ${caratsharp.dir} exists and is a directory .... this is what you want?

Here is, I think, a slightly modified version of your build.xml that, I think, does what you
want .... maybe not in the most elegant way, but it is at least functional:

<target name="checkForCaratSharpDir">
  <available property="present" file="${caratsharp.dir}" />
  <available property="isaDir" file="${caratsharp.dir}" type="dir" />
  <condition property="isaFile">
      <isset property="present" />
        <isset property="isaDir" />

<target name="exists" depends="checkForCaratSharpDir" if="isaDir">
  <echo message="${caratsharp.dir} exists" /> 
  <antcall target="clean" /> 
  <antcall target="prepare" /> 
  <antcall target="jar" /> 
  <antcall target="copy_jar" /> 
<target name="printError" depends="checkForCaratSharpDir" unless="present">
  <echo message="${caratsharp.dir} does not exist" /> 
<target name="printFileError" depends="checkForCaratSharpDir" if="isaFile">
  <echo message="${caratsharp.dir} is a file instead of a directory" /> 
<target name="all" depends="exists,printError,printFileError"   description="Cleans, compile
then builds the JAR file." /> 

At least that's the way it looks to me ....

Good luck,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message