This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
roger wong
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18096
48
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
roger wong
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18096
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic