What is a good way to handle a version number in a Java application?

前端 未结 6 808
[愿得一人]
[愿得一人] 2020-12-23 10:25

I am developing a desktop app using Java and Swing Application Framework. I have an application about box and I\'d like to have that box contain some indication of what ver

6条回答
  •  一生所求
    2020-12-23 11:02

    You're making it too complicated. SVN provides the version number as a macro, like CVS.

    Create a simple inverface containing a constant, and have SVN instantiate that through a macro, like

    public interface IVersionNumber {
        public static final String version = "$Id$" ;
    }
    

    You need to tell SVN to use keywords on that file, as

    $ svn propset svn:keywords "Id" IVersion.java

    You can read about properties here.

提交回复
热议问题