开发者

VM Arguments with maven-failsafe-plugin [closed]

开发者 https://www.devze.com 2023-02-22 06:43 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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


Use the <systemPropertyVariables> element to set system properties (I don't see where <argLine> is mentioned in the documentation, where did you find it?):

<configuration>
    <systemPropertyVariables>
        <test.data>true</test.data>
    </systemPropertyVariables>
</configuration>


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号