• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 28126
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 28126
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic