roger wong wrote:
Tim Holloway wrote:I just create a "version.txt" file in the webapp root and serve it up when someone wants to know the app version. You can, of course make a "version.jsp" that reads your build properties and displays the build version if you like. In my case, Maven is automcatically stuffing the build version into the deployed version.txt, so I don't need runtime logic.
Do you mean you put build.properties in your war so that version.jsp can read it in runtime?
Since I do not use maven, could you please tell how to use ant the way maven stuffs the build version into deployed version txt.
Thank you.
No, I have a model "version.txt" file in a special directory that Maven copies and does variable substitutions on to produce a file in the form "webappname version x.y.x" in the root of the WAR. Where "x.y.x" is the version number that's in the Maven pom.xml (build) file. Since I put the file in the WAR root, I can use the URL "http://www.myserver.com:8080/mywebapp/version.txt" to retrieve it. Although Internet Explorer has a lamentable tendancy to want to open this file using Notedpad instead of simply displaying it as a page.
Then again, IE doesn't run under Linux.
For Ant, there's a revision number "bumping" task that can be used in much the same way, although I forget the details.