<!-- mvn clean package -Ptest -->
<profiles>
<profile>
<!--不同环境Profile的唯一id-->
<id>dev</id>
<properties>
<!-- active是自定义字段 -->
<active>dev</active>
</properties>
<activation>
<!--这个字段表示默认激活-->
<activeByDefault>true</activeByDefault>
<!--当jdk环境版本1.8或以上时,此profile被激活-->
<jdk>[1.8)</jdk>
<!--根据当前操作系统-->
<os>
<name>Windows 10</name>
<family>Windows</family>
<arch>x64</arch>
<version>19041.685</version>
</os>
<!--通过系统环境变量,name-value自定义-->
<property>
<name>env</name>
<value>dev</value>
</property>
<!--通过文件的存在或缺失-->
<file>
<exists>/data/dev.txt</exists>
<missing>/data/test.txt</missing>
</file>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<active>test</active>
</properties>
</profile>
</profiles>
settings.xml
mave目录下的settings.xml也可以添加下面的代码来指定激活哪个profile
<activeProfiles>
<activeProfile>profileTest1</activeProfile>
</activeProfiles>