bmargulies
bmargulies

Reputation: 99993

dealing with empty defaults in ant macrodefs

Goal: macrodef a task based on exec, and make timeout optional in the defined task just as it is in the underlying exec task.

If I don't provide a default for <attribute name="timeout"/>, then ant requires a timeout.

If I provide a default of "", then the exec task complains.

Do I really need to create a conditional that asks if the timeout parameter has a value other than a silly default, and then have two copies of the exec invocation depending?

Upvotes: 0

Views: 132

Answers (1)

ewan.chalmers
ewan.chalmers

Reputation: 16235

I don't see a clean way to do it without a conditional. But if you're not too fussy, you could go with a really long default value of timeout - e.g. a day or a week or a year's worth of milliseconds.

Upvotes: 1

Related Questions