Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 16613 invoked from network); 6 Sep 2004 12:35:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 6 Sep 2004 12:35:54 -0000 Received: (qmail 57991 invoked by uid 500); 6 Sep 2004 12:35:41 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 57941 invoked by uid 500); 6 Sep 2004 12:35:40 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 57926 invoked by uid 99); 6 Sep 2004 12:35:40 -0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_RFC_IPWHOIS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [195.101.39.227] (HELO GWOUT.thalesgroup.com) (195.101.39.227) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 06 Sep 2004 05:35:39 -0700 Received: from thalescan.corp.thales (200.3.2.3) by GWOUT.thalesgroup.com (NPlex 6.5.026) id 413A89150005A54A for user@ant.apache.org; Mon, 6 Sep 2004 14:36:43 +0200 Received: from lowplex.mut.thales ([10.33.19.4]) by thalescan with InterScan Messaging Security Suite; Mon, 06 Sep 2004 14:35:31 +0200 Received: from tisplex.tisfr.thales (142.1.6.1) by lowplex.mut.thales (NPlex 6.5.026) id 413A88AE0003E056 for user@ant.apache.org; Mon, 6 Sep 2004 14:35:31 +0200 Received: from tisplex.tisfr.thales (142.1.6.1) by tisplex.tisfr.thales (NPlex 6.5.026) id 413A82000003C95C for user@ant.apache.org; Mon, 6 Sep 2004 14:35:28 +0200 Received: from tismlkplex.tisfr.thales ([142.58.3.100]) by tisplex with InterScan Messaging Security Suite; Mon, 06 Sep 2004 14:35:28 +0200 Received: from tismlkplex.tisfr.thales (142.58.3.100) by tismlkplex.tisfr.thales (NPlex 6.5.026) id 413A890E00017583 for user@ant.apache.org; Mon, 6 Sep 2004 14:35:28 +0200 Received: from p-103393.mkf.syseca ([142.1.146.103]) by tismlkplex with InterScan Messaging Security Suite; Mon, 06 Sep 2004 14:35:27 +0200 To: "Ant Users List" Subject: Re: Looping/exception handling in Ant project References: Message-ID: Date: Mon, 06 Sep 2004 14:38:55 +0200 From: "Olivier Croisier" Organization: Thales Information Systems Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Opera M2/7.50 (Win32, build 3778) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Have you tried outsourcing the problem ? I mean, to use your OS's batch commands to loop on the directory's files and call ant for each of them, rather than looping from within your ant task ? With linux's bash it can be done very easily. For example : for i in *.input; do ant -file "$i"; done; (assuming your files are named with a ".input" extension, and your ant task takes a -file argument to designate the file to work on... You get the idea.) This must also be possible using the Windows "shell"... Hope this helps, Olivier On Mon, 6 Sep 2004 13:21:05 +0100, Hobbs, Gareth wrote: > Hi, > > I am using Ant to automate a processing pipeline - an Ant project is used to > define a sequence of processing steps to be applied to an input file > (usually by way of a target containing an XSLT task). If all steps succeed, > the last target in the project generates a "success" output document. If any > step fails, causing the project to fail, a custom subclass of DefaultLogger > generates a "failure" output document. > > This works well for a single input file - I currently pass the input > filename property to the project as a command-line argument. > > However, I need to execute the pipeline iteratively over multiple input > files - a specific input directory may contain more than one file matching a > given pattern. I can't process all files within each target, as there are > assumptions made that only one file is being worked on, such as when naming > temporary files created by one target and picked up by the next. > > I also need to preserve my exception handling - should the pipeline fail for > a particular input file, then the "success" and "failure" processing > outlined above should apply, but then the project should move onto the next > matching file instead of terminating. > > At present I can only think of creating an outer project that calls the > existing project within a loop (using ) and an exception handler > (using ). I am not sure of the release status of the cc-contrib > code and whether its appropriate to use this within my validated > application. In any case, I would prefer to solve this declaratively rather > than procedurally! > > Your thoughts and suggestions gratefully received! > > Thanks, > Gareth > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > > -- CROISIER Olivier Software Engineer Thales IS - ANS olivier.croisier@thales-is.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org