简体   繁体   English

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

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

I'm using buildnumber-maven-plugin and maven-war-plugin to generate and put SVN revision into manifest.mf file in my WAR file as an entry. 我正在使用buildnumber-maven-plugin和maven-war-plugin生成并将SVN修订版放入WAR文件中的manifest.mf文件中作为条目。

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

So far, so good. 到现在为止还挺好。

I would like to display it on Tapestry page (5.3.6 version). 我想在Tapestry页面(5.3.6版本)上显示它。 How would I do that? 我该怎么做? What is the best approach? 最好的方法是什么?

<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>

Add in your MANIFEST.MF 添加您的MANIFEST.MF

Implementation-Build 实施构建

Implementation-Version: 11111 实施版本:11111

In your AppModule.java 在您的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);
    .......
}

Add property in your page class 在页面类中添加属性

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

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

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