您的位置:首页 > 其它

Maven的settings.xml文件结构之activeProfiles

2016-08-25 09:18 351 查看
无论是在pom.xml文件中,还是在settings.xml文件中,都可以配置多个<profile>。但是并非所有的<profile>都会被激活,即该<profile>的配置生效与否,可以通过如下方式进行控制:

在pom.xml文件中通过<profile>的<activation>
在settings.xml文件中通过<profile>的<activation>

在settings.xml文件中通过<activeProfiles>

其中,通过<profile>的<activation>配置激活对应的<profile>条件,这个在pom.xml文件中和在settings.xml文件中是一致的,详见pom.xml文件的配置。

在settings.xml文件中,还可以通过<activeProfiles>直接给出被激活的<profile>(可以有多个),示例如下:

<activeProfiles>
<activeProfile>env-test</activeProfile>
</activeProfiles>

在上述示例中,默认激活<id>env-test</id>的<profile>。当然,也可以根据需要,默认激活多个<profile>。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息