【发布时间】:2019-05-17 23:21:55
【问题描述】:
我正在开发一个 spring-boot 应用程序。我的 POM 中有两个配置文件,但是当我尝试使用 clean install -Pdev 构建项目时,它不会反映 application.properties 中的更改,它只会反映我在其中一个配置文件中使用“activeByDefault”标签时.
<profiles>
<profile>
<id>dev</id>
<properties>
<activatedProperties>dev</activatedProperties>
</properties>
</profile>
<profile>
<id>release</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<activatedProperties>release</activatedProperties>
</properties>
</profile>
</profiles>
如果我正在运行全新安装 -Pdev,我会在我的 application.properties 中得到它。 激活属性=@激活属性@
如果我设置<activeByDefault>true</activeByDefault>,那么我将在 application.properties 中获取值。
激活属性=释放。
令人沮丧的是我无法使用其他个人资料。
【问题讨论】:
-
我认为您需要在 -P 和配置文件名称之间添加一个空格。
-
@JJF 有或没有空格都是一样的。
标签: java maven spring-boot pom.xml maven-plugin