1

I see on the web some images refferred to Spring Boot Admin showing the app version in the wallboard page.

I'm using latest version of SBA, currently 2.1.6 and i can't see the versions in the wallboard.
I see something like this.

Reading the documentation it seems that a maven plugin is needed:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I added it in the pom.xml of a micro-service and I restarted all docker swarms stacks (including SBA) but no changes.
I did some search but I can't find any reference.

Roberto Manfreda
  • 2,345
  • 3
  • 25
  • 39

2 Answers2

3

The 'spring-boot-maven-plugin' is required to generate the build-info in

/target/classes/META-INF/build-info.properties

Spring Boot Admin picks up the build info including the application version from this file. Please check if this file is generated. You need to execute the maven plugin first or just run

 mvn clean install

enter image description here

Mohit Singh
  • 496
  • 2
  • 11
  • I can't verify at the moment, anyway I'll let you know! Thank you :) – Roberto Manfreda Dec 13 '19 at 20:14
  • Hi @MohitSingh I verified... I can see the file build-info.properties and it seems correctly generated. But still no versions on SBA! Any idea? – Roberto Manfreda Dec 16 '19 at 14:27
  • No other ideas as of now :( But to be sure that the file is generated correctly, can you please see the version like build.version=1.X.X in build-info.properties? For me, it's working like this only, if I remove the build-info file the version is also removed from the wallboard. – Mohit Singh Dec 16 '19 at 14:37
  • Are you using the latest version? Anyway yes at the moment i can see build.version=0.1.4-SNAPSHOT. Maybe they removed that feature in the latest version... I really can't find any documentation except the build-info relative docs – Roberto Manfreda Dec 16 '19 at 14:39
  • Maybe you can try restarting your SBA and service again. So that it's registered freshly. – Mohit Singh Dec 16 '19 at 14:41
  • I am using the version: 2.1.1 – Mohit Singh Dec 16 '19 at 14:43
  • I tried restarting all my stacks... no changes. I'm currently using version 2.1.6.. Anyway I'm using the Eureka server too, clients are registering through it. Don't know if it can impact in some way! – Roberto Manfreda Dec 16 '19 at 14:58
  • 2
    Solved passing the build.version through the metadatamap – Roberto Manfreda Dec 16 '19 at 15:06
1

For Spring Boot applications

The easiest way to show the version, is to use the build-info goal from the spring-boot-maven-plugin, which generates the META-INF/build-info.properties.

1) Change/add the plugin in the pom.xml as below

<build>
<plugins>
    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>build-info</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>

2) Delete your target folder and do a mvn clean install

3) Restart your app and check the version is there



I did so and it worked.

Src.➡Show Version in Application List






Dirty fix

If the previous solution does not work... You can read the properties from the META-INF (in the jar) and concatenate it to the app name (here: myApp-service).

1) Do the previous step (add goal in maven plugin)

2) Add in the properties:

spring.config.import=classpath:META-INF/build-info.properties
spring.application.name=myApp-service ${build.version} 

3) Check the result (image below )

dirty fix display





Src.➡spring-boot-maven-plugin build-info.properties

vvauban
  • 165
  • 4
  • 8