Overriding gatewayAddress in Maven Build

This is probably a question for StackOverflow, but is there a way to override the property in the ignition-maven-plugin so that I have it install to a different gateway address after it compiles?

I want to leave the default as localhost but I use a VM to test modules when I'm in my office and don't want to have to update the pom file because I forget to revert it before committing...

Disclaimer: Maven is not my forte.

It looks like there might be some workarounds (you can configure the POM once such that it also accepts passed in arguments from the command line) but they don't look great.

What if you set it in the POM to some hardcoded domain name, and then configure your local DNS in the two environments (e.g. via hosts file) to target the appropriate gateway? Somewhat overkill, but only has to be configured once per possible host.

1 Like

Ok, I might have answered my own question.

In the root pom.xml I added a:

<properties>
    <gatewayAddress>http://localhost:8088</gatewayAddress>
</properties>

Then in the build pom.xml I set the gateway address to look at the project property:

<gatewayAddress>${gatewayAddress}</gatewayAddress>

Then I added a "settings.xml" file to my home folder with the following:

<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <profiles>
        <profile>
            <id>office</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <gatewayAddress>http://second-gateway-address-here:8088</gatewayAddress>
            </properties>
        </profile>
    </profiles>
</settings>

And I compile with:

mvn install -s ~/settings.xml

I'm pretty happy about that because now I can do some Jenkins automation...

3 Likes