【发布时间】:2021-02-06 05:39:59
【问题描述】:
我的项目是基于 maven+TestNG+Selenium 的,我们的要求是从 maven 命令行编辑 src/test/resources/collector.properties 中存在的属性文件的值。请注意,我们有多个属性文件,只能在属性文件下方进行编辑
例如:mvn test -Dtest=ScenarioLogin#Login -Dreport.host=http://10.120.100.70:2023/api/reports/ -Dreport.token=akjfs3425645XXXX
使用上面的命令我应该能够更新以下值
collector.properties:
report.host = http://10.123.123.70:8080/api/
report.token=XXXXXXXX
POM.XML
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${org.apache.maven.plugins.maven-compiler-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${source.and.target.JVM.version}</source>
<target>${source.and.target.JVM.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${org.apache.maven.plugins.maven-surefire-plugin.version}</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
请帮忙看看如何实现,pom.xml中需要修改什么
【问题讨论】:
标签: java maven testng properties-file