views:

85

answers:

3

Hello,

I need to put versions of my software in my jsp pages. Can I do it trough XML files? Can Subversion record this in files that has been versioned?

thankful

Daniel Alves da Fonseca Maciel

+1  A: 

Subversion keyword substitution might do the trick, for example, add something similar to in each of your jsps:

<!-- 
$LastChangedDate$
$Rev$
-->

Then everytime you commit, svn should replace the $keywords$ with the appropriate value. See the svnbook for more details.

Dave Paroulek
Every jsp page will have a different version number, if you do it like this. This may or may not be after what OP is after. $LastChangedDate$ expands to date when current file was last modified.
Juha Syrjälä
A: 

Thanks Dave.

I´ll do the tests. This value will show through comments or at page?

Daniel Maciel
subversion puts the version number in the source file, so the way it gets displayed is up to you. you can create a static variable somewhere that gets displayed in a page.
Ken Liu
A: 

To create version number that is same across all the JSP pages.

  1. Have your build process create a file that contains the version number.
    • execute something like this in your build: svnversion -c trunk > version.txt
  2. Package version.txt with your web application (inside .war file).
  3. Create a function to read version information from the version.txt file
  4. Call function from JSP pages and display version information. (Preferably from some footer/header fragment that is included in every page).
Juha Syrjälä