diff --git a/pom.xml b/pom.xml
index 3c5ec94..5f2abed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,41 +134,6 @@
-
- com.google.code.maven-replacer-plugin
- replacer
- 1.5.3
-
-
- replace-version-number
- generate-sources
-
- replace
-
-
-
-
- ${project.basedir}/src/main/java
-
- **/JavaApiVersionInfo.java
-
- true
-
-
- MAVEN_PROJECT_NAME = ".*"
- MAVEN_PROJECT_NAME = "${project.name}"
-
-
- MAVEN_PROJECT_VERSION = ".*"
- MAVEN_PROJECT_VERSION = "${project.version}"
-
-
- BUILD_NO = ".*"
- BUILD_NO = "${travisBuildNumber}"
-
-
-
-
maven-resources-plugin
2.6
@@ -220,6 +185,22 @@
+
+
+ src/main/resources
+ true
+
+ **/utplsql-api.version
+
+
+
+ src/main/resources
+ false
+
+ **/utplsql-api.version
+
+
+
diff --git a/src/main/java/org/utplsql/api/JavaApiVersionInfo.java b/src/main/java/org/utplsql/api/JavaApiVersionInfo.java
index 60456b3..0acd555 100644
--- a/src/main/java/org/utplsql/api/JavaApiVersionInfo.java
+++ b/src/main/java/org/utplsql/api/JavaApiVersionInfo.java
@@ -1,5 +1,13 @@
package org.utplsql.api;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URISyntaxException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
/** This class is getting updated automatically by the build process.
* Please do not update its constants manually cause they will be overwritten.
*
@@ -9,13 +17,23 @@ public class JavaApiVersionInfo {
private JavaApiVersionInfo() { }
- private static final String BUILD_NO = "123";
+
private static final String MAVEN_PROJECT_NAME = "utPLSQL-java-api";
- private static final String MAVEN_PROJECT_VERSION = "3.1.2-SNAPSHOT";
+ private static String MAVEN_PROJECT_VERSION = "unknown";
- public static String getVersion() {
- return MAVEN_PROJECT_VERSION + "." + BUILD_NO;
+ static {
+ try {
+ MAVEN_PROJECT_VERSION = Files.readAllLines(
+ Paths.get(JavaApiVersionInfo.class.getClassLoader().getResource("utplsql-api.version").toURI())
+ , Charset.defaultCharset())
+ .get(0);
+ }
+ catch ( IOException | URISyntaxException e ) {
+ System.out.println("WARNING: Could not get Version information!");
+ }
}
+
+ public static String getVersion() { return MAVEN_PROJECT_VERSION; }
public static String getInfo() { return MAVEN_PROJECT_NAME + " " + getVersion(); }
}
diff --git a/src/main/resources/utplsql-api.version b/src/main/resources/utplsql-api.version
new file mode 100644
index 0000000..3fb16e7
--- /dev/null
+++ b/src/main/resources/utplsql-api.version
@@ -0,0 +1 @@
+${project.version}.${travisBuildNumber}
\ No newline at end of file
diff --git a/src/test/java/org/utplsql/api/JavaApiVersionTest.java b/src/test/java/org/utplsql/api/JavaApiVersionTest.java
new file mode 100644
index 0000000..65f2220
--- /dev/null
+++ b/src/test/java/org/utplsql/api/JavaApiVersionTest.java
@@ -0,0 +1,13 @@
+package org.utplsql.api;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class JavaApiVersionTest {
+
+ @Test
+ void getJavaApiVersion() {
+ assertTrue(JavaApiVersionInfo.getVersion().startsWith("3.1"));
+ }
+}