spilot
spilot

Reputation: 635

Ant: scan file and write property

In a file called foo.fxml in ${basedir} there is a section that reads

<!-- ANT SEARCH HERE 5 -->

where 5 may be any integer.

How can I get an ant property to hold the value of that integer, in this case, 5?

Upvotes: 0

Views: 43

Answers (1)

Jeanne Boyarsky
Jeanne Boyarsky

Reputation: 12266

There's two steps to this. First, you need to read the file, which you can do with LoadFile. Then you can use a regular expression to get the number in the comment. Ant-Contrib has PropertyRegex which is good for this.

Upvotes: 1

Related Questions