user1985536
user1985536

Reputation:

Check properties ant file in a target

I'm a novice in Java. In my Ant file, I would like to create a target "init" which checks if the properties declared exist (else it affects them a default value), but I don't have any idea how to do.

Upvotes: 0

Views: 70

Answers (1)

Ed Staub
Ed Staub

Reputation: 15690

It's easier than you'd think. Just set them in the init target. In Ant, setting properties is "first setter wins" - if they are already set, the setting in the init target will be ignored.

There are several ways to set properties, but the most commonly used is:

<property name="foo" value="dist"/>

Upvotes: 1

Related Questions