Hom*_*ker 0 intellij-idea maven maven-failsafe-plugin
我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>
Run Code Online (Sandbox Code Playgroud)
提前致谢。问候
该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>
Run Code Online (Sandbox Code Playgroud)
有了这个:
mvn failsafe:integration-test不会获取系统属性。mvn integration-test、mvn verify等将mvn deploy使用它们。includes.| 归档时间: |
|
| 查看次数: |
1899 次 |
| 最近记录: |