Skip to content

Commit f515a5a

Browse files
committed
HBX-2962: Inject the version string during the build
Signed-off-by: Koen Aers <[email protected]>
1 parent 47fbf89 commit f515a5a

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

orm/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,26 @@
8282
</dependency>
8383
</dependencies>
8484

85+
<build>
86+
<plugins>
87+
<plugin>
88+
<groupId>org.jboss.maven.plugins</groupId>
89+
<artifactId>maven-injection-plugin</artifactId>
90+
<configuration>
91+
<bytecodeInjections>
92+
<bytecodeInjection>
93+
<expression>${project.version}</expression>
94+
<targetMembers>
95+
<methodBodyReturn>
96+
<className>org.hibernate.tool.api.version.Version</className>
97+
<methodName>versionString</methodName>
98+
</methodBodyReturn>
99+
</targetMembers>
100+
</bytecodeInjection>
101+
</bytecodeInjections>
102+
</configuration>
103+
</plugin>
104+
</plugins>
105+
</build>
106+
85107
</project>
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
package org.hibernate.tool.api.version;
22

33
public interface Version {
4-
5-
final static String CURRENT_VERSION = "6.4.11-SNAPSHOT";
4+
5+
/**
6+
* @deprecated Use {@link #versionString()} instead.
7+
*/
8+
@Deprecated
9+
final static String CURRENT_VERSION = versionString();
10+
11+
static String versionString() {
12+
// This implementation is replaced during the build with another one that returns the correct value.
13+
return "UNKNOWN";
14+
}
615

716
}

0 commit comments

Comments
 (0)