0

How to add VERSION_INFO meta data to jar with spring boot ?

I have seen the plugin

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
</plugin>

with the execution "repackage" but I cannot add this meta_data in my executable jar file.

psv
  • 3,147
  • 5
  • 32
  • 67

1 Answers1

0

Do you really need the version in META-INF/MANIFEST.MF?

If you add these placeholders to application.yml properties file:

# app name and build version updated during build process from Maven properties.
info:
  app:
    name: @project.artifactId@
  build:
    version: @project.version@

They get replaced while building the artifact and available when sending a GET request to /info actuator endpoint, for instance:

curl "http://localhost:8080/info"
{"app":{"name":"demo-cxf"},"build":{"version":"0-SNAPSHOT"}}
ootero
  • 3,235
  • 2
  • 16
  • 22