I'm trying to run tests on a buildserver that doesn't have the environment variable I need set.
The variable is used from within a spring context xml file to resolve the location of property files.
e.g. classpath:config/${EnvironmentType}/myfile.properties
I'm using the failsafe plugin and trying the various documented methods (even deprecated ones) for setting the variables. None of it makes a lick of difference, the variable is never resolved.
My config is below :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>Integration tests against mocks</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<skipTests>${skip.integration.mock.tests}</skipTests>
<includes>
<include>**/*ITMock.java</include>
</includes>
<argLine>-DEnvironmentType="DevelopmentIntegration"</argLine>
<systemPropertyVariables>
<EnvironmentType>DevelopmentIntegration</EnvironmentType>
</systemPropertyVariables>
<environmentVariables>
<EnvironmentType>DevelopmentIntegration</EnvironmentType>
</environmentVariables>
<systemProperties>
<property>
<name>EnvironmentType</name>
<value>DevelopmentIntegration</value>
</property>
</systemProperties>
<forkMode>false</forkMode>
</configuration>
</execution>
<execution>
<id>Verify</id>
<goals>
<goal>verify</goal>
</goals>
<configuration>
<skipTests>false</skipTests>
</configuration>
</execution>
</executions>
</plugin>
How can I get this env var set for my tests without actually setting it on the machine?
Note : Running this with mvn verify -DEnvironmentType="DevelopmentIntegration" works. I want it to work with just mvn verify.
Cheers, Peter