我尝试了这两种方法
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属性吗?