11package org .utplsql .api ;
22
3+ import java .io .IOException ;
4+ import java .io .InputStream ;
5+ import java .io .InputStreamReader ;
6+ import java .net .URISyntaxException ;
7+ import java .nio .charset .Charset ;
8+ import java .nio .file .Files ;
9+ import java .nio .file .Paths ;
10+
311/** This class is getting updated automatically by the build process.
412 * Please do not update its constants manually cause they will be overwritten.
513 *
@@ -9,13 +17,23 @@ public class JavaApiVersionInfo {
917
1018 private JavaApiVersionInfo () { }
1119
12- private static final String BUILD_NO = "123" ;
20+
1321 private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api" ;
14- private static final String MAVEN_PROJECT_VERSION = "3.1.2-SNAPSHOT " ;
22+ private static String MAVEN_PROJECT_VERSION = "unknown " ;
1523
16- public static String getVersion () {
17- return MAVEN_PROJECT_VERSION + "." + BUILD_NO ;
24+ static {
25+ try {
26+ MAVEN_PROJECT_VERSION = Files .readAllLines (
27+ Paths .get (JavaApiVersionInfo .class .getClassLoader ().getResource ("utplsql-api.version" ).toURI ())
28+ , Charset .defaultCharset ())
29+ .get (0 );
30+ }
31+ catch ( IOException | URISyntaxException e ) {
32+ System .out .println ("WARNING: Could not get Version information!" );
33+ }
1834 }
35+
36+ public static String getVersion () { return MAVEN_PROJECT_VERSION ; }
1937 public static String getInfo () { return MAVEN_PROJECT_NAME + " " + getVersion (); }
2038
2139}
0 commit comments