Reputation: 5582
I'm using spring boot and was trying to retrieve the current application version. (basically the version in the pom.xml)
On the spring boot ref site I can see there is a ${application.version} that is meant to have the version present in the MANIFEST file. (I have checked in the jar, and the I indeed can see this line
Implementation-Version: 0.1.1-SNAPSHOT
but in the code when I try to retrieve ${application.version} (using @Value throws an error saying the prop cannot be found) and using env.getProperty("application.version") returns null.
Is there anything I need to setup in order to be able to use this prop ?
Upvotes: 0
Views: 2279
Reputation: 1027
I found the application.version
property only works in banner.txt
. I read the Implementation-Version
from manifest file directly, see How to read my META-INF/MANIFEST.MF file in a Spring Boot app?
Upvotes: 1
Reputation: 8401
The application.version is only available when you are run the application as built jar file. java -jar springboot.jar
When running within a editor you will not have the version available.
Upvotes: 0