<!-- 定义profile --> <profiles> <!-- 开发环境 --> <profile> <id>dev</id> <properties> <!-- 定义profileActive属性 --> <profileActive>dev</profileActive> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <!-- 测试环境 --> <profile> <id>test</id> <properties> <profileActive>test</profileActive> </properties> </profile> <!-- 生产环境 --> <profile> <id>prod</id> <properties> <profileActive>prod</profileActive> </properties> </profile> </profiles>
编译打包时指定参数:
<build> <finalName>${project.name}-${project.version}-${profileActive}</finalName> </build>