首页 > 解决方案 > 用于运行多个配置文件的 maven 命令行

问题描述

我的 pom.xml 中有 2 个配置文件,需要同时打包 2 个 WAR 文件,这是 pom

    <profiles>
        <profile>
            <id>TEST</id>
            -- scripts
        </profile>

        <profile>
            <id>DEV</id>
             -- scripts
        </profile>
    </profiles>

我试过了

clean package -P Dev,Test

但是生成的 WAR 是最后一个(测试)并且开发配置文件没有运行

标签: maven

解决方案


您可以使用多个P参数:

mvn clean package -P Dev -P Test

推荐阅读