1:“maven父节点”或“当先pom文件加上”以下profiles
<profiles> <profile> <id>dev</id> <activation> <!--默认环境--> <activeByDefault>true</activeByDefault> </activation> <properties> <testVerSion>xxxxxDev</testVerSion> <vvv>xxxxxxxxx</vvv> </properties> </profile> <profile> <id>test</id> <properties> <testVerSion>xxxxxTest</testVerSion> <vvv>vvv</vvv> </properties> </profile> </profiles> </project>
2:pom文件引入jar包(必须要有“默认环境”)
<dependency>
<groupId>com.zxy.product</groupId>
<artifactId>system-api</artifactId>
<version>${testVerSion}</version>
</dependency>
3:打包
mvn clean package -P test