From df13e59608419b2dceb7fc5adadb27e069957dd3 Mon Sep 17 00:00:00 2001 From: Koen Aers Date: Thu, 27 Feb 2025 15:26:48 +0100 Subject: [PATCH] HBX-2962: Inject the version string during the build Signed-off-by: Koen Aers --- orm/pom.xml | 22 +++++++++++++++++++ .../hibernate/tool/api/version/Version.java | 11 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/orm/pom.xml b/orm/pom.xml index 5b875a4ecc..ad6156307b 100644 --- a/orm/pom.xml +++ b/orm/pom.xml @@ -82,4 +82,26 @@ + + + + org.jboss.maven.plugins + maven-injection-plugin + + + + ${project.version} + + + org.hibernate.tool.api.version.Version + versionString + + + + + + + + + diff --git a/orm/src/main/java/org/hibernate/tool/api/version/Version.java b/orm/src/main/java/org/hibernate/tool/api/version/Version.java index 9238a82d3c..925f3fce9f 100644 --- a/orm/src/main/java/org/hibernate/tool/api/version/Version.java +++ b/orm/src/main/java/org/hibernate/tool/api/version/Version.java @@ -2,6 +2,15 @@ public interface Version { - final static String CURRENT_VERSION = "6.3.3-SNAPSHOT"; + /** + * @deprecated Use {@link #versionString()} instead. + */ + @Deprecated + final static String CURRENT_VERSION = versionString(); + + static String versionString() { + // This implementation is replaced during the build with another one that returns the correct value. + return "UNKNOWN"; + } }