Maven多环境打包

2021-12-28 12:34:45 浏览数 (1)

代码语言:javascript复制
<profiles>
        <profile>
            <id>dev</id>
            <properties>
                <profiles.active>dev</profiles.active>
            </properties>

        </profile>

        <profile>
            <id>beta</id>
            <properties>
                <profiles.active>beta</profiles.active>
            </properties>
        </profile>
        <profile>
            <id>prd</id>
            <properties>
                <profiles.active>prd</profiles.active>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
    </profiles>
代码语言:javascript复制
	<build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources/config</directory>
                <excludes>
                    <exclude>**/**</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources/config/${profiles.active}	   </directory>
            </resource>
        </resources>
</build>

.../resources/config/dev or beta or prd

mvn clean install -P prd

0 人点赞