Reputation: 1314
I'm using the Spring boot gradle plugin and have put this in my application.yml
:
spring:
application:
name: myapp
version: ${version}
I process the resource file for tokens using:
processResources {
filesMatching('application.yml') {
expand(project.properties)
}
}
And I use this annotation in my controller:
public class MyController {
@Value("${spring.application.version}")
private String appversion
...
And it all works, yay! The problem is that I can't figure out what is actually controlling the version because this reports version 0.0.1-SNAPSHOT
even though I specify a different version
in gradle.properties
.
I tried updating the springBoot DSL thusly:
springBoot {
buildInfo {
properties {
version = "${project.version}"
}
}
}
But it has no effect. Could someone help me understand the proper way to increment/manage the version using the Spring Boot gradle plugin?
Upvotes: 0
Views: 3728
Reputation: 12096
As said in my comment, the way you have set the version in gradle.properties
and how you configured the application.yml
is correct.
I guess you still have a version
property defined in your main build.gradle
, which overrides the value set in the gradle.properties
with value 0.0.1-SNAPSHOT
Upvotes: 2