Search code examples
maveneclipse-rcptycho

Add version information to product of RCP application


Hi I want to add the current Version (manually defined in the parent pom) of my RCP Application in an "About" section which means I need to access it during runtime. What is the default way to do that for a pomless maven tycho build? I tried the properties-maven-plugin but have problems combining the properties file with my build. So I guess there has to be a more convenient way. Thanks you for any help!


Solution

  • Eclipse itself uses the maven-resources-plugin to add version information to the about.mappings file:

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