Better to adopt the Way of Ant (tm) rather than fighting against it.
Think of your problem this way, and restructure your build file to match:
What you want to do is to put your article information into your
database if there are any articles available.
Before you can do that, you need to make sure there is a separate
articles file for any articles present in the raw XML.
Before you can do that, you need to make sure your raw XML files are
filtered to remove junk.
Before you can do that, you need to make sure your raw XML files are
uncompressed.
So what you really want is something like (adjust to fit your real problem):
<project default="upload-to-db" >
<target name="upload-to-db" depends="generate-article-file"
if="article-file-present">
...
</target>
<target name="generate-article-file" depends="filter-junk">
...
<available property="article-file-present" />
</target>
<target name="filter-junk" depends="uncompress-raw-xml">
...
</target>
<target name="uncompress-raw-xml">
<unzip />
</target>
</project>
This may seem counterintuitive since the property appears to be declared
after the "upload-to-db" target's "depends" attribute is analyzed, but
in fact nothing is determined about whether the "upload-to-db" target
will execute until all of its dependencies have been executed.
Mario Madunic wrote:
Sorry I didn't give enough info.
Since I'm a relative newbie to ant I create a pipeline task not relying on any
other target. So in the example below my workflow looks like the following:
unzip archive of xml files
filter xml files
parse xml files (will create CSV\csvArt.xml if there are any type="articles")
<exec> bcp csv to SQLServer
So what I wanted to insert in my flow was
<available file="CSV\csvArt.xml" property="artAvailable" />
after the parse xml files
then test the value of artAvailable and if true <exec> bcp into SQLServer
Is this possible? or a pointer to an example or tutorial.
Marijan (Mario) Madunic
Quoting "Anderson, Rob (Global Trade)" <[EMAIL PROTECTED]>:
Use the if attribute of <target>...
<target name="exec-something" if="artAvailable">
<exec ...
</target>
Be aware that this does not test the value of the artAvailable property,
only whether or not it exists. See the manual for more info.
http://ant.apache.org/manual/using.html#targets
-Rob Anderson
-----Original Message-----
From: Mario Madunic [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 11, 2007 10:40 AM
To: user@ant.apache.org
Subject: newbie help: conditional exec
I have the following in my ant task to test for the existence
of an xml file after processing
<available file="CSV\csvArt.xml" property="artAvailable" />
What I want to do is run <exec> based on the above property
value of true. I can't seem to find a task to do this. Any
help will be appreciated.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For
additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]