Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top