我systemPropertyVariables
为maven-failsafe-plugin
. 在集成阶段运行集成测试时,systemPropertyVariables
会正确选取。
当我通过我的 IDE (IntelliJ) 运行单个测试时,systemPropertyVariables
也会被选中,但我不想要那样。
有没有办法在不使用 maven 配置文件的情况下防止这种情况发生?
<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>
提前致谢。问候
该configuration
元素处于插件级别,因此它将适用于所有构建。要限制它,请创建一个执行并将配置移入其中。
<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>
有了这个:
mvn failsafe:integration-test
不会选择系统属性。mvn integration-test
,mvn verify
,mvn deploy
等会使用它们。includes
.本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句