正确使用properties-maven-plugin来设置系统属性?

Eri*_*ric 5 java maven

我试图用来properties-maven-plugin设置一个我可以在我的 Java 类中检索的系统变量。在我的pom.xml文件中,我有:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0-alpha-2</version>
    <executions>
        <execution>
            <goals>
                <goal>set-system-properties</goal>
            </goals>
            <configuration>
                <properties>
                    <property>
                        <name>my.propertyName</name>
                        <value>value</value>
                    </property>
                </properties>
           </configuration>
       </execution>
   </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

然后在我的 Java 类中,我有一行:

String value = System.getProperty("my.propertyName");
Run Code Online (Sandbox Code Playgroud)

但那行代码返回空值。

我如何使它工作?:o)