Forward maven properties to exec:java goal
You can ensure the maven properties are available to your main forcing <projectProperties />
property type.
Tip: you can still override potentially conflicting properties if you set them after.
pom.xml
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
...
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.Main</mainClass>
<arguments>
<argument>argument1</argument>
...
</arguments>
<systemProperties>
<projectProperties />
<systemProperty>
<key>myproperty</key>
<value>myvalue</value>
</systemProperty>
...
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
...
</project>