我正在尝试使用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)