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!
精彩评论