繁体   English   中英

如何显示在Tapestry5页面上的war manifest.mf文件中存储的SVN版本?

[英]How to display SVN revision stored in war manifest.mf file on Tapestry5 page?

我正在使用buildnumber-maven-plugin和maven-war-plugin生成并将SVN修订版放入WAR文件中的manifest.mf文件中作为条目。

<Implementation-Build>${buildNumber}</Implementation-Build>

到现在为止还挺好。

我想在Tapestry页面(5.3.6版本)上显示它。 我该怎么做? 最好的方法是什么?

<html t:type="layout" title="" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
    <div>
        <h4>Version:</h4>
             ${project.version}
        <h4>Revision:</h4>
            ${buildNumber}
    </div>
</html>

添加您的MANIFEST.MF

实施构建

实施版本:11111

在您的AppModule.java中

public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
    .......
    String version = "0";
    if (null != AppModule.class.getPackage()) {
        version = AppModule.class.getPackage().getImplementationVersion();
    }

    configuration.add(SymbolConstants.APPLICATION_VERSION, version);
    .......
}

在页面类中添加属性

@Inject
@Symbol(SymbolConstants.APPLICATION_VERSION)
@Property
protected String buildNumber;

暂无
暂无

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

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