user1050755
user1050755

Reputation: 11691

Any way to override properties-maven-plugin's set-system-properties by -Dpropname=value on the command line?

Is there any way to override properties-maven-plugin's set-system-properties by -Dpropname=value on the command line? In other words: to set system properties only if they have not been set already?

Upvotes: 2

Views: 783

Answers (1)

Joe
Joe

Reputation: 31087

Go via a regular property:

<properties>
    <propname>Default Value</propname>
</properties>

...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>set-system-properties</goal>
            </goals>
            <configuration>
                <properties>
                    <property>
                        <name>system.property.name</name>
                        <value>${propname}</value>
                    </property>
                </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

Then run with -Dpropname="Specified Value".

Upvotes: 2

Related Questions