Good question. I used to do this on purpose. I categorically do not adhere to this approach, but in any case, I have listed it for comparison with (I hope) the best approaches that others will soon publish.
To maintain version information in a medium-sized Java code environment, I created a simple class to store major, minor, and version versions as static constants and create a formatted version string. Then I created a perl script to check the class outside of version control, replace the version components with those specified as script arguments, and check it back.
The script does most of the work, so the version upgrade process is pretty simple and fast. I had to implement this quickly, so there are probably better ways to do this. I simply did not have the time or motivation to explore the best alternatives.
A. Levy
source share