【发布时间】:2017-06-28 15:28:49
【问题描述】:
我有一个用 maven 编译的 WAR 存档。 我想在 jsf 页面中插入编译时间戳。
如何在编译时更改 jsf 页面中的字符串? 示例
<div>Compiled at (copilationTime)</div>
必须变成
<div>Compiled at 2017-01-01 15:50</div>
如果太复杂的话,我有一个applicationscooped bean,我写了
<div>Compiled at ${MyApp.compilationTime}</div>
但是在我的课堂上我如何设置'xxxx'?
public class MyApp{
String compilationTime = 'xxxx';
public String getCompilationTime(){
return compilationTime;
}
}
【问题讨论】:
-
我不知道这是否是您要求的确切内容,但您可以使用 maven 生成一个包文件(称为 version.properties)(实际上,使用 maven buildnumber 插件,例如:@987654321 @) 然后从文件内容中检索信息(而不是从变量中)。