带有 maven-failsafe-plugin 的 VM 参数
我正在尝试将 VM 参数传递到 Maven,特别是针对由故障安全运行的一套测试。
我的 pom.xml 如下所示:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Dtest.data=true</argLine>
</configuration>
<version>2.7.2</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
...
当我运行命令 mvn clean verify
时,依赖于 test.data 设置为 true 的测试失败。但是,当我运行命令 mvn -Dtest.data=true clean verify
时,测试全部通过。我需要在我的 CI 环境的 pom 中设置参数。
我在这里错过了什么吗?
预先感谢,
皮特
I'm trying to pass a VM argument into Maven, specifically for a suite of tests run by failsafe.
My pom.xml looks like this:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>-Dtest.data=true</argLine>
</configuration>
<version>2.7.2</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
...
When I run the command mvn clean verify
the tests that rely on test.data being set to true are failing. However, when I run the command mvn -Dtest.data=true clean verify
the tests all pass. I need the argument to be set inside the pom for my CI environment.
Am I missing something here?
Thanks in advance,
Pete
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
元素 设置系统属性(我没有看到文档中提到
,你在哪里找到它?):Use the
<systemPropertyVariables>
element to set system properties (I don't see where<argLine>
is mentioned in the documentation, where did you find it?):好吧,事实证明我尝试运行的集成测试需要将此参数传递到 Tomcat 插件而不是 Failsafe 插件中。谢谢你们的帮助!
Ok it turns out that the integration tests that I was trying to run needed to have this argument passed into the Tomcat plugin not the Failsafe plugin. Thanks for your help guys!