Maven - 如何从 POM.xml 传递系统 属性 变量中的部分值
Maven - How to pass partial value in system property variables from POM.xml
下面是我在 pom.xml 中的 url
变量,我必须在不同环境中将 ${evn}
中的 qa
值附加到 运行,
我想从我的 url
标签中单独传递 env
以传递 运行 时间,如下所示
mvn clean test -Denv=qa
我希望在测试中获得 url 就像 - https://www.qagoogle.com
<systemPropertyVariables>
<url>https://www.${env}google.com/</url>
</systemPropertyVariables>
您需要向 pom.xml
添加一个属性部分:
<properties>
<env>qa</env>
</properties>
如果您想用 -Denv
覆盖变量,您还需要将其添加到 systemPropertyVariables
<systemPropertyVariables>
<env></env>
<url>https://www.${env}google.com/</url>
</systemPropertyVariables>
然后,你可以运行mvn clean test -Denv=qa
下面是我在 pom.xml 中的 url
变量,我必须在不同环境中将 ${evn}
中的 qa
值附加到 运行,
我想从我的 url
标签中单独传递 env
以传递 运行 时间,如下所示
mvn clean test -Denv=qa
我希望在测试中获得 url 就像 - https://www.qagoogle.com
<systemPropertyVariables>
<url>https://www.${env}google.com/</url>
</systemPropertyVariables>
您需要向 pom.xml
添加一个属性部分:
<properties>
<env>qa</env>
</properties>
如果您想用 -Denv
覆盖变量,您还需要将其添加到 systemPropertyVariables
<systemPropertyVariables>
<env></env>
<url>https://www.${env}google.com/</url>
</systemPropertyVariables>
然后,你可以运行mvn clean test -Denv=qa