ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckn...@onebox.com
Subject Setting a property based on a command-line parameter
Date Fri, 21 Jul 2006 19:41:05 GMT
I'm using Ant to orchestrate a processing pipeline that begins with a query to an Oracle database
and ends with a file containing a report in HTML format.

One of the reports I have to produce comes in two flavors; daily and weekly. These are distinguished
by the lower end of the date range the SQL query will include in selecting records. That is
to say, the low end of the date range in the daily report is two days before the current date,
while the low end of the date range in the weekly report is eight days before the current
date.

I have been looking for a means of setting the value for the low end of the date range in
Ant, triggered by passing the command line parameter -Dweek=true. Based on this (either the
parameter is set or it is not), I'd like to set a property to one or another value.

If week=true then I'd like to set the value of start.date to the current date minus eight
days.
If the value is not set or it is not "true", I'd like to set the value of start.date to the
current date minus two days.

The start.date property will be passed by ora:sqlplus as a parameter to a SQL script. I've
been poking around the Ant docs for two afternoons, but while it seems like I'm almost finding
what I need, I'm coming up short.

So as I see it, there are two parts to my hoped-for solution.
1) Setting a property to one or another value based on the value of command-line parameter.
2) Performing date arithmetic in Ant.

Has anyone done either of these before?

Thanks.
-- 
Charles Knell
cknell@onebox.com - email

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


Mime
View raw message