• 当我们没有显式指定环境时, maven 会默认取 activeByDefault 为 true 的 profile
  • 需要注意的是, 当父子 pom 都有相同的 profile id 时, 都需要显式指定 activeByDefault true, 如果不指定, 那么并不会加载没有指定 activeByDefault true 的 properties
  • 结论: 对于父子 pom 相同 id 的 profile, 每个 profile 节点都要指定 activeByDefault true
<!-- 
不显式指定环境时, 会取 activeByDefault true 的环境变量, 
需要注意的是: 没指定 activeByDefault true 的其他相同 profile id 的 properties 是不会生效的

 -->
<activation>
    <activeByDefault>true</activeByDefault>
</activation>
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐