Commit 32e368f5 by Johannes Edmeier

Use build-info for displaying the version

As now with spring boot 1.4 there is a special goal for generating the build- information, we use it for displaying the version in spring boot admin. The old info.version property still works but is deprecated. From now on build.info.version is taken into account.
parent add518ab
......@@ -146,12 +146,26 @@ NOTE: You can include the Spring Boot Admin to your Eureka server. Add the depen
[[show-version-in-application-list]]
=== Show version in application list ===
To get the version show up in the admin's application list you have to set `info.version`. For example using maven filtering during the build:
To get the version show up in the admin's application list you can use the `build-info` goal from the `spring-boot-maven-plugin`, which generates the `META-INF/build-info.properties`. See also the http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-build-info[Spring Boot Reference Guide].
[source]
.application.properties
[source,xml]
.pom.xml
----
info.version=@project.version@
<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>
----
[[jmx-bean-management]]
......
......@@ -32,6 +32,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......
......@@ -32,6 +32,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......
......@@ -32,6 +32,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......
spring.resources.cachePeriod=3600
server.port=8081
info.version=@pom.version@
info.stage=test
logging.file=/tmp/log.log
spring.application.name=@pom.artifactId@
......
......@@ -34,6 +34,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......@@ -41,14 +42,6 @@
<addResources>false</addResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpversion>2.0</wtpversion>
<jeeversion>6.0</jeeversion>
</configuration>
</plugin>
</plugins>
</build>
</project>
info:
version: @pom.version@
stage: test
spring:
application:
name: @pom.artifactId@
name: spring-boot-admin-sample-war
boot:
admin:
url: http://localhost:8080
......
......@@ -32,6 +32,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......
......@@ -32,6 +32,7 @@
<execution>
<goals>
<goal>repackage</goal>
<goal>build-info</goal>
</goals>
</execution>
</executions>
......
......@@ -78,6 +78,9 @@ module.run(function ($rootScope, $state, Notification, Application, ApplicationG
var info = response.data;
application.version = info.version;
delete info.version;
if (info.build && info.build.version) {
application.version = info.build.version;
}
application.info = info;
}).finally(function () {
application.refreshing = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment