maven profile 多環境
阿新 • • 發佈:2018-11-10
<profiles> <profile> <!-- 本地開發環境 --> <id>dev</id> <properties> <profiles.active>dev</profiles.active> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <!-- 測試環境 --> <id>test</id> <properties> <profiles.active>test</profiles.active> </properties> </profile> <profile> <!--生產環境 --> <id>pro</id> <properties> <profiles.active>pro</profiles.active> </properties> </profile> </profiles>
<build> <resources> <resource> <directory>src/main/resources</directory> <!-- 資源根目錄排除各環境的配置,防止在生成目錄中多餘其它目錄 --> <excludes> <exclude>pro/*</exclude> <exclude>dev/*</exclude> </excludes> </resource> <resource> <directory>src/main/resources/${profiles.active}</directory> </resource> </resources> </build>
都在<project></project> 裡