作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 2 个配置文件,可能会也可能不会一起使用来运行一组测试。它们每个都需要不同的 vmargs 才能运行,但如果它们一起使用,可以将它们相互附加。
我正在寻找的是一种将 argLine 设置为其当前值加上我设置的值的串联的方法。
我希望它会像
<argLine>${argLine} -DnewVMArg</argLine>
<my.argLines></my.argLines>
全局,然后在配置文件中修改它。
<my.argLines>${my.argLines} -myUniqueToProfileArgs</my.argLines>
<argLines>
成为:
<argLines>${my.argLines}</argLines>
最佳答案
定义默认参数 -DnewVMArg
内argLine
像下面这样:
<properties>
<customArg/>
<argLine>${customArg} -DnewVMArg</argLine>
</properties>
<profiles>
<profile>
<id>profile1</id>
<properties>
<customArg>-DmyUniqueToProfile1Args</customArg>
</properties>
</profile>
<profile>
<id>profile2</id>
<properties>
<customArg>-DmyUniqueToProfile2Args</customArg>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration/>
</plugin>
....
mvn surefire:test -X
(...)java -jar -DnewVMArg (...)
mvn surefire:test -X -Pprofile1
(...)java -DmyUniqueToProfile1Args -DnewVMArg -jar (...)
关于Maven 万无一失 : append to argLine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13829538/
我有 2 个配置文件,可能会也可能不会一起使用来运行一组测试。它们每个都需要不同的 vmargs 才能运行,但如果它们一起使用,可以将它们相互附加。 我正在寻找的是一种将 argLine 设置为其当前
我有一套现有的 Karate 测试,可以使用以下方法在不同的环境(开发/质量检查)上运行: mvn test -DargLine="-DauthUser=*** -DauthPassword=***
我正在使用 maven-surefire-plugin + Sonar 一起使用,我想向 maven 的 argLine 参数添加一些额外的值-surefire-插件。 所以我做到了:
在 Eclipse 中,我执行“Run As”、“Maven test”或“Maven build”,但测试失败。在“运行配置”中,我将目标设置为 clean package -DargLine="-
我是一名优秀的程序员,十分优秀!