为RCP应用程序的产品添加版本信息

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

您好,我想在“关于”部分添加 RCP 应用程序的当前版本(在父 pom 中手动定义),这意味着我需要在运行时访问它。对于 pomless Maven tycho 构建来说,默认的方法是什么?我尝试了properties-maven-plugin,但在将属性文件与我的构建结合起来时遇到问题。所以我想必须有一种更方便的方法。谢谢您的帮助!

maven eclipse-rcp tycho
1个回答
0
投票

Eclipse 本身使用

maven-resources-plugin
将版本信息添加到
about.mappings
文件中:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.3.1</version>
    <executions>
        <execution>
            <id>process-about.mappings</id>
            <phase>prepare-package</phase>
            <configuration>
                <outputDirectory>${project.build.directory}</outputDirectory>
                <overwrite>true</overwrite>
                <resources>
                    <resource>
                        <directory>${basedir}</directory>
                        <includes>
                            <include>about.mappings</include>
                        </includes>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </configuration>
            <goals>
                <goal>copy-resources</goal>
            </goals>
        </execution>
    </executions>
</plugin>
© www.soinside.com 2019 - 2024. All rights reserved.