简体   繁体   English

维护GWT Web应用程序的内部版本号

[英]Maintain Build Version Number for GWT Web Application

I am working on GWT application. 我正在研究GWT应用程序。 I want to maintain the version number for all major buid of my application and have defined version number say as example (1.0.1 changes to 1.0.1.1 or 1.0.2 etc.). 我想维护我的应用程序的所有主要版本的版本号,并已定义了版本号,例如(1.0.1更改为1.0.1.1或1.0.2等)。 I want to show the version number on my about page. 我想在我的“关于”页面上显示版本号。

I have read about ant and maven where Build version number can be maintained, but my current GWT project is not maintained with ant or maven like tools, I am using GWT compile. 我已经阅读了有关可以维护内部版本号的ant和maven的信息,但是我当前的GWT项目没有使用ant或maven之类的工具进行维护,我正在使用GWT编译。

I want to know, how I will be able to maintain buid version number in GWT web applications, so I can use it to show in my about page (Without changing the name of war file). 我想知道,我将如何在GWT Web应用程序中维护buid版本号,因此可以使用它在我的关于页面中显示(无需更改war文件的名称)。

Please suggest or provide references to find solution. 请提出建议或提供参考以找到解决方案。

You can create version class with constants for version values and use in GWT application. 您可以使用用于版本值的常量创建版本类,并在GWT应用程序中使用。 Use the class also on server side for dynamic pages or to check if the GWT application has correct version. 也可以在服务器端使用该类来获取动态页面,或者检查GWT应用程序的版本是否正确。

Any time you compile release just increase one of the values. 每当您编译release时,只需增加其中一个值即可。 Later you can automate it with ant script and generate this class just before compilation (fe using ant variable or Jenkins version number variable). 稍后,您可以使用ant脚本将其自动化并在编译之前生成此类(例如,使用ant变量或Jenkins版本号变量)。

 public class Version {
    public static final int MAJOR_VERSION = 1;
    public static final int MINOR_VERSION = 2;
    public static final int BUILD_NUMBER = 123456;
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM