BuildNumber for modules

Hello all.

I’m trying to set automatically a build number for a module i’m writing but I can’t find where to define it.

I’m using IntelliJ 15.0 and here are some code extracts to show the properties I used :

Main POM.xml

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
        <buildNumber>${maven.build.timestamp}</buildNumber>
    </properties>

Build POM.xml (in section)

 <moduleDescription>A module to communicate with CarteWeb. Build : ${maven.build.timestamp}</moduleDescription>

After packaging and installing the module, i got this :

What I would like to do is setting the buildNumber in the “Version” row (b0) instead of in the “Description” row. It is surely possible but how to proceed ?

Thanks in advance.

Ignition uses the fourth component of the version number as the build number. So version 1.2.3.456789 in module.xml will become Version 1.2.3 (b456789) in the gateway. It hits an internal limit around 10 digits (32bit?) – you can’t use a high resolution timestamp.

Ok. Thank you for the reply.

It works when I use a static version (for example 1.0.0.17) but when I try to package with a dynamic version (1.0.0.${maven.build.timestamp}), I got warnings and errors telling me that “‘version’ contains an expression but should be a constant”.

Is it possible to use a dynamic build number ?

You need to use the maven.build.timestamp variable directly, instead of trying to reference it from another variable. For example:

    <properties>
        <maven.build.timestamp.format>yyyyMMddHH</maven.build.timestamp.format>
    </properties>
..........
<configuration>
    <archive>
        <manifestEntries>
            <X-Ignition-Build-Date>${maven.build.timestamp}</X-Ignition-Build-Date>
        </manifestEntries>
    </archive>
</configuration>

Thank you for the reply.

Is your code supposed to be in the same POM file ? I can’t make it work, wherever I may add these lines. My build number stays set to 0.

:scratch:

In your build pom.xml, modify the value of the moduleVersion element in when configuring ignition-maven-plugin.

It works !

Thank you.