GWT 获取构建日期

问题描述 投票:0回答:2

当我在 GWT 中编译 Web 应用程序时,我希望编译设置日期/时间或更新应用程序中的内部版本号,但我只是不知道如何操作。 有没有办法在编译时运行代码? 或者是否可以让我的编译器在正确的位置填写此内容(通过project.xml)?

date gwt
2个回答
3
投票

您可以在调用 GWT 编译器之前修改源代码(使用 Maven 和资源过滤或使用 Ant 以及可能任何类型的构建脚本相对容易),或者可能为此编写一个 GWT 生成器。

请参阅 https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsDeferred#generators


0
投票

您可以获取文档的最后修改日期,这应该是构建日期:

public static native String getDocumentLastModifiedDate() 
/*-{ 
      return document.lastModified; 
}-*/; 
© www.soinside.com 2019 - 2024. All rights reserved.