diff --git a/build.gradle.kts b/build.gradle.kts
index 2c7dd0e08d4442668e1990fb5534b598ad4c91b6..c6c79eae19ded4acebdf9f74254356a66a9cf57c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -134,6 +134,10 @@ tasks.register<Copy>("copyLogo") {
}
}
+springBoot {
+ buildInfo()
+}
+
sass {
download {
version = "1.26.3"
diff --git a/src/main/java/nl/tudelft/ewi/walkytalky/controller/StaticController.java b/src/main/java/nl/tudelft/ewi/walkytalky/controller/StaticController.java
index f2a0e9975f1a2ab2c200f8dae60e446136ba1552..aa626dd85bbbb72181f111bf18400a7893087f98 100644
--- a/src/main/java/nl/tudelft/ewi/walkytalky/controller/StaticController.java
+++ b/src/main/java/nl/tudelft/ewi/walkytalky/controller/StaticController.java
@@ -22,8 +22,10 @@ package nl.tudelft.ewi.walkytalky.controller;
import nl.tudelft.ewi.walkytalky.services.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.info.BuildProperties;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
/**
* Controller for home/informational pages.
@@ -34,6 +36,9 @@ public class StaticController {
@Autowired
private AuthService authService;
+ @Autowired(required = false)
+ private BuildProperties buildProperties;
+
@GetMapping("/")
public String index() {
return authService.pageForUserRole("home/index");
@@ -63,4 +68,12 @@ public class StaticController {
public String contribute() {
return "contribute/index";
}
+
+ @ModelAttribute("version")
+ public String version() {
+ if (buildProperties == null) {
+ return "development";
+ }
+ return buildProperties.getVersion();
+ }
}