ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anna Teittinen" <ateitti...@i-a-i.com>
Subject Re: Need help in build.xml file...
Date Mon, 29 Dec 2008 16:36:42 GMT
Hello Glenn and all,

The solution given below is what I wanted my build.xml file to do.  I appologize if I had
not been clear with my question earlier.
With all the replies I received, I now understand how the 'unless' attribute works and have
a better understanding of how to use the available and condition tags as well.
Thank you all very much again for your time and help!

--Anna


-----Original message-----
From: "glenn opdycke-hansen" glennoph@gmail.com
Date: Fri, 26 Dec 2008 23:39:26 -0500
To: "Ant Users List" user@ant.apache.org, "Anna Teittinen" ateittinen@i-a-i.com
Subject: Re: Need help in build.xml file...

> I created an Ant script based on the code you provided.  The following
> messages were returned:
> 
> exists:
> Skipped because property 'present' not set.
> 
> printError:
> Skipped because property 'isaFile' not set.
> 
> I did a quick rewrite of your code:
> 
>  <target name="checkForCaratSharpDir">
>  <available property="csd.present" file="${caratsharp.dir}" type="dir"/>
>  </target>
> 
>  <target name="exists" depends="checkForCaratSharpDir" if="csd.present">
>  <echo message="${caratsharp.dir} exists" />
>  <antcall target="clean-prepare-jar-copy_jar" />
>  </target>
> 
>  <target name="printError" depends="checkForCaratSharpDir"
> unless="csd.present">
>  <echo message="${caratsharp.dir} does not exist" />
>  </target>
>  <target name="all" depends="exists,printError" description="Cleans, compile
> then builds the JAR file." />
> 
>  <target  name="clean-prepare-jar-copy_jar" >
>  <echo> depends="clean, prepare, jar, copy_jar" </echo>
>  </target>
> 
> It now returns the following:
> 
> checkForCaratSharpDir:
> 
> exists:
> 
> printError:
>      [echo] cs-src does not exist
> 
> all:
> 
> 
> 
> 
> On Fri, Dec 26, 2008 at 6:21 PM, Anna Teittinen <ateittinen@i-a-i.com>wrote:
> 
> > Hello,
> >
> > I am relatively new to using ant.
> > Can somebody help me with a problem I have in my build.xml file?
> > Below is a snippet of code from my build.xml file.
> > Below, "caratsharp.dir" refers to a directory.
> > Basically, if that directory exists, then the clean, prepare, jar, and
> > copy_jar targets will get called; otherwise, an error msg should be printed
> > and nothing more happens.
> >
> > When this build.xml is called when the "caratsharp.dir" directory exists,
> > all the antcall commands get done... great!
> > However, when I run this script when the "caratsharp.dir" directory does
> > not exist, the error msg does not get printed.
> >
> > Does anyone have any insight to why the error msg ("${caratsharp.dir} does
> > not exist") does not get printed?
> >
> >
> >  <target name="checkForCaratSharpDir">
> >  <available property="present" file="${caratsharp.dir}" />
> >  <available property="isaDir" file="${caratsharp.dir}" type="dir" />
> >  <condition property="isaDir">
> >  <and>
> >  <isset property="present" />
> >  <not>
> >  <isset property="isaFile" />
> >  </not>
> >  </and>
> >  </condition>
> >  </target>
> >  <target name="exists" depends="checkForCaratSharpDir" if="present">
> >  <echo message="${caratsharp.dir} exists" />
> >  <antcall target="clean" />
> >  <antcall target="prepare" />
> >  <antcall target="jar" />
> >  <antcall target="copy_jar" />
> >  </target>
> >  <target name="printError" depends="checkForCaratSharpDir" if="isaFile">
> >  <echo message="${caratsharp.dir} does not exist" />
> >  </target>
> >  <target name="all" depends="exists,printError" description="Cleans,
> > compile then builds the JAR file." />
> >
> >
> >
> > Thanks so much in advance for your help,
> > --Anna
> >

__________________________________________________________________________
This message and all attachments are PRIVATE, and contain information that
is PROPRIETARY to Intelligent Automation, Inc. You are not authorized to
transmit or otherwise disclose this message or any attachments to any
third party whatsoever without the express written consent of Intelligent
Automation, Inc. If you received this message in error or you are not
willing to view this message or any attachments on a confidential basis,
please immediately delete this email and any attachments and notify
Intelligent Automation, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message