0

Is it possible to embed build number in arbitrary source file in eclipse?

Suppose I have a general project to edit some config files and then to upload them to the server with Ant script.

Now I want that some config file contain build number or upload date-time or some other counting stamp.

Is this possible?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

2

To embed information in a file you can use the standard copy task with an embedded filterset to put dynamic information into a source file.

Ant also supplies a buildnumber task that is useful to generating a sequential number each time ANT runs.

Finally I'd recommend looking at the 3rd party JReleaseInfo for an alternative mechanism that might be more useful to adopt (or emulate). It generates Java classes designed to to embedded in your code. The advantage of this approach is that you can lookup the version at runtime.

Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • How to know which task supports `filterset`? Does `SCP` task support it? – Suzan Cioc Jun 03 '13 at 10:58
  • No the documentation of the scp task does not describe filtersets: http://ant.apache.org/manual/Tasks/scp.html. Doesn't stop you from locally preparing the file before uploading it. – Mark O'Connor Jun 03 '13 at 11:01