I defined some systemPropertyVariables
for the maven-failsafe-plugin
.
When the integration tests are run during the integration phase, the systemPropertyVariables
are picked up correctly.
When I run a single test via my IDE (IntelliJ), the systemPropertyVariables
are also picked up but I do not want that.
Is there a way to prevent this, without using maven profiles?
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<includes>
<include>**/*End2EndTest.java</include>
</includes>
<systemPropertyVariables>
<tomcat.host>host</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.context>/</tomcat.context>
<tests.browser.name>chrome</tests.browser.name>
<tests.selenium.grid.address>http://localhost:4444/wd/hub/</tests.selenium.grid.address>
<spring.profiles.active>build</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
Thanks in advance. Regards
The configuration
element is at the plugin level, thus it will apply for all builds. To limit it, create an execution and move the configuration into it.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<!-- this configuration applies to all builds
using this plugin, whether by specific
goal, or phase. -->
<includes>
<include>**/*End2EndTest.java</include>
</includes>
</configuration>
<executions>
<execution>
<!-- this configuration only is used if
the integration-test phase, or later
phase, is executed -->
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<tomcat.host>host</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.context>/</tomcat.context>
<tests.browser.name>chrome</tests.browser.name>
<tests.selenium.grid.address>http://localhost:4444/wd/hub/</tests.selenium.grid.address>
<spring.profiles.active>build</spring.profiles.active>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
With this in place:
mvn failsafe:integration-test
would NOT pick up the system properties.mvn integration-test
, mvn verify
, mvn deploy
etc will use them.includes
.