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

时间:2015-09-01 18:25:02

标签: 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>

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

String value = System.getProperty("my.propertyName");

但该行代码返回null。

如何让它发挥作用? :O)

0 个答案:

没有答案