aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes what is the best practice if the user want to see the version of a webapp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "what is the best practice if the user want to see the version of a webapp" Watch "what is the best practice if the user want to see the version of a webapp" New topic
Author

what is the best practice if the user want to see the version of a webapp

roger wong
Ranch Hand

Joined: Oct 21, 2009
Posts: 31
e.g., First I tag the web project with version 1.0. I will set the version in the build.properties so that the build will get the version from the cvs.

Besides, the user of the webapp want to see the version of the running webapp. What the best practice to do so?

Thank you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
roger wong
Ranch Hand

Joined: Oct 21, 2009
Posts: 31
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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

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.
roger wong
Ranch Hand

Joined: Oct 21, 2009
Posts: 31
Tim Holloway wrote:
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.


It really helps. Did not find bumping task in ant, but found below in ant mannual:

<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt">
<filterset>
<filter token="DATE" value="${TODAY}"/>
</filterset>
</copy>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the best practice if the user want to see the version of a webapp