【发布时间】:2019-07-20 16:14:36
【问题描述】:
我正在尝试使用名为testVar 的系统属性的不同值多次执行下面的插件。我的pom.xml 中有以下插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<skip>false</skip>
<forkCount>1</forkCount>
<threadCount>3</threadCount>
</configuration>
<executions>
<execution>
<id>before-run</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<testVar>aaa</testVar>
</systemPropertyVariables>
</configuration>
</execution>
<execution>
<id>main-run</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<testVar>bbb</testVar>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
我在运行System.getProperty("testVar") 时收到null。但是,当testVar 在插件级别声明时,我可以正确访问它。怎么了?
【问题讨论】:
标签: java maven pom.xml maven-surefire-plugin