How to access the current Subversion build number?

前端 未结 16 2148
刺人心
刺人心 2020-11-27 05:43

How can you automatically import the latest build/revision number in subversion?

The goal would be to have that number visible on your webpage footer like SO does.

16条回答
  •  北海茫月
    2020-11-27 06:10

    Here is a hint, how you might use Netbeans' capabilities to
    create custom ant tasks which would generate scm-version.txt:

    Open your build.xml file, and add following code right after

    
    
      
    
    

    Now, Netbeans strores the Subversion version string to scm-version.txt everytime you make clean/build.

    You can read the file during runtime by doing:

    getClass().getResourceAsStream("scm-version.txt"); // ...
    

    Don't forget to mark the file scm-version.txt as svn:ignore.

提交回复
热议问题