From fd07b540b770c4a61559d87e9c450f0df34a9e88 Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Thu, 27 Feb 2025 17:12:50 +0100 Subject: [PATCH] HBX-2962: Inject the version string during the build Signed-off-by: Koen Aers --- pom.xml | 17 +++++++++++++++++ src/java/org/hibernate/tool/Version.java | 9 +++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3c54df306c..efd01274da 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,23 @@ + + org.jboss.maven.plugins + maven-injection-plugin + + + + ${project.version} + + + org.hibernate.tool.Version + versionString + + + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/src/java/org/hibernate/tool/Version.java b/src/java/org/hibernate/tool/Version.java index aaee3b6413..eff33666ea 100644 --- a/src/java/org/hibernate/tool/Version.java +++ b/src/java/org/hibernate/tool/Version.java @@ -4,10 +4,10 @@ final public class Version { - public static final String VERSION = "5.1.13-SNAPSHOT"; - private static final Version instance = new Version(); + public static final String VERSION = instance.versionString(); + private static Logger log = Logger.getLogger( Version.class.getName() ); static { @@ -22,6 +22,11 @@ public String getVersion() { return VERSION; } + public String versionString() { + // This implementation is replaced during the build with another one that returns the correct value. + return "UNKNOWN"; + } + public static Version getDefault() { return instance; }