Maven属性替换不适用于Spring Boot 2和yaml配置文件

时间:2019-09-03 11:15:07

标签: maven spring-boot

我尝试了这两种方法

x:
  y: "@project.version@"

x:
  y: ^project.version^

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
    <delimiters>
        <delimiter>^</delimiter>
    </delimiters>
    <useDefaultDelimiters>false</useDefaultDelimiters>
</configuration>

第二个,并且无法获取Maven项目版本或Spring的@Value("${x.y}")中的其他属性。 使用

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    </parent>

,没有其他特殊的构建配置。 知道可能是什么问题,或以其他方式在application.yaml中设置Maven属性吗?

0 个答案:

没有答案