You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过命令行参数替换Maven Profile中的配置属性

问题说明

我有一个settings.xml文件,用于向pom.xml注入配置属性,希望通过命令行参数替换该文件中Profile节点内的属性值。

settings.xml 对应代码片段

<profile>
        <id>ch1</id>
        <properties>
            <business.group.id>${ch.business.group.id}</business.group.id>
            <connected.app.client.id>${ch.connected.app.client.id}</connected.app.client.id>
            <connected.app.client.secret>${ch.connected.app.client.secret}</connected.app.client.secret>
        </properties>
    </profile>

我使用的命令行指令

mvn deploy -DmuleDeploy -P=ch1 '-Dch.business.group.id=any_value' '-Dch.connected.app.client.id=any_value' '-Dch.connected.app.client.secret=any_value'

内容的提问来源于stack exchange,提问作者Weslley L Silva

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 02:23:09