diff --git a/gradle/javaproject.gradle b/gradle/javaproject.gradle
index b829be7474642b8c2b0d0563002fd5a5e02d4a9b..beb28df63e4e8daa096755bc4bf414c36f45b0a5 100644
--- a/gradle/javaproject.gradle
+++ b/gradle/javaproject.gradle
@@ -150,7 +150,12 @@ def calculateBuildInfo() {
     } else if (isGitProject()) {
         def gitlogoutput = execute_working_dir('git', ['log', '-1', '--format=%at'], '../' + project.name)
         project.ext.revisionNumber = Integer.parseInt(gitlogoutput[0])
-        project.ext.versionNumber = 'SNAPSHOT'
+        def tag = 'git describe --tags'.execute().text.trim()
+        if (tag == null || tag.isEmpty()) {
+            project.ext.versionNumber = 'SNAPSHOT'
+        } else {
+            project.ext.versionNumber = tag
+        }
     } else {
         project.ext.revisionNumber = 1
         project.ext.versionNumber = 'SNAPSHOT'