无法从配置文件配置附加系统属性

时间:2018-08-18 04:27:10

标签: maven pom.xml maven-profiles

我具有maven故障安全插件的构建配置,其中包括>>> np.transpose(np.meshgrid(a, b), (2, 1, 0))

systemPropertyVariables

我还有一个配置文件,可以通过<build> <plugins> <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>2.19.1</version> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> <configuration> <systemPropertyVariables> <buildDirectory>${project.build.directory}</buildDirectory> </systemPropertyVariables> </configuration> </plugin> </plugins> </build> 将少量属性附加到同一插件:

pluginManagement

但是我无法从此配置文件中读取属性。如果我在构建插件配置部分删除<profile> <id>test</id> <activation> <property> <name>test.host</name> </property> </activation> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <configuration> <systemPropertyVariables> <TEST_HOST>test.host</TEST_HOST> </systemPropertyVariables> </configuration> </plugin> </plugins> </pluginManagement> </build> </profile> 并保留配置文件的pluginManagement配置,则可以正常工作。似乎我需要在合并使用时合并这些属性,因此我尝试将systemPropertyVariablescombine.children="append"添加到插件的combine.self="append"中,但这没有帮助。

1 个答案:

答案 0 :(得分:1)

我设法通过在不可触摸(或pariah)父级和当前child之间添加一个额外的pom来实现这一目标,我称这种新的中间pom {{1 }} =)

所以midboymidboy仅具有以下区别;

pariah

此pom成为<plugin> <artifactId>maven-failsafe-plugin</artifactId> <groupId>org.apache.maven.plugins</groupId> <version>3.0.0-M3</version> <inherited>false</inherited> </plugin> 的新父pom,而它使用原始child pom作为其父。

pariah --- [继承] ---> child --- [继承] ---> midboy

我使用pariah切断了故障安全插件,该插件被传递到inherited:false中,并将其基于配置文件的配置添加到其自身的本地故障安全插件和配置中。 &这很完美!

这次不跳过测试! ?

child

p.s。不要忘记为Running com.test.so51905256.PropITCase [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 s - in com.test.so51905256.PropITCase 个人资料添加某种<activation>