combatibility with Java 9+, Tested with Java 11; JAXB library v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 13 Sep 2020 12:01:35 +0200
branchv_0
changeset 253 d8442b266ca8
parent 252 a9d4a8d5c57f
child 254 c4b901ff0703
combatibility with Java 9+, Tested with Java 11; JAXB library
distributions/debian/build.sh
java/sql-dk/pom.xml
scripts/sql-dk.sh
--- a/distributions/debian/build.sh	Sat Jul 25 17:25:19 2020 +0200
+++ b/distributions/debian/build.sh	Sun Sep 13 12:01:35 2020 +0200
@@ -50,7 +50,7 @@
 Package: sql-dk
 Version: $VERSION
 Maintainer: $NAME
-Depends: java7-runtime-headless | java7-runtime | java8-runtime-headless | java8-runtime
+Depends: default-jre-headless (>= 2:1.8) | java8-runtime-headless, jaxb
 Suggests: libpostgresql-jdbc-java,libmysql-java
 Copyright: $COPYRIGHT_FILE
 Extra-Files: config.xsd, config.rnc, config.xsl
--- a/java/sql-dk/pom.xml	Sat Jul 25 17:25:19 2020 +0200
+++ b/java/sql-dk/pom.xml	Sun Sep 13 12:01:35 2020 +0200
@@ -15,6 +15,17 @@
 	
 	<dependencies>
 		<dependency>
+			<groupId>jakarta.xml.bind</groupId>
+			<artifactId>jakarta.xml.bind-api</artifactId>
+			<version>2.3.3</version>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.xml.bind</groupId>
+			<artifactId>jaxb-impl</artifactId>
+			<version>2.3.3</version>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
 			<groupId>org.junit.jupiter</groupId>
 			<artifactId>junit-jupiter-engine</artifactId>
 			<version>${junit.version}</version>
@@ -86,6 +97,22 @@
 					</dependency>
 				</dependencies>
 			</plugin>
+			<plugin>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<version>3.1.1</version>
+				<executions>
+					<execution>
+						<phase>process-sources</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/lib</outputDirectory>
+							<includeScope>runtime</includeScope>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 	
--- a/scripts/sql-dk.sh	Sat Jul 25 17:25:19 2020 +0200
+++ b/scripts/sql-dk.sh	Sun Sep 13 12:01:35 2020 +0200
@@ -18,6 +18,24 @@
 	"/usr/share/java/mysql.jar"
 );
 
+# Standard libraries
+[ -n "$STANDARD_LIB" ] || STANDARD_LIB=(
+	"/usr/share/java/jaxb-api.jar"
+	"/usr/share/java/jaxb-runtime.jar"
+);
+# JAXB library is needed since Java 9 (up to Java 8 it was part of the JRE).
+# By default, we use JARs from the distribution.
+# Some distributions might contain older versions of the JAXB library (2.3.0)
+# that work but generate following waringns:
+#   WARNING: An illegal reflective access operation has occurred
+#   WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (file:/usr/share/java/jaxb-runtime.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
+#   WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
+#   WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
+#   WARNING: All illegal access operations will be denied in a future release
+# In order to get rid of them, the user can use newer JARs from Maven that are copied into the java/sql-dk/target/lib/ directory during build.
+# This is done by adding them in the STANDARD_LIB variable in his environment.sh file.
+
+
 # Additional JDBC drivers might be specified in CUSTOM_JDBC array
 # Plugins (formatters etc.) might be specified in PLUGINS array
 
@@ -26,7 +44,7 @@
 
 CLASS_PATH="$JAR";
 
-for e in "${STANDARD_JDBC[@]}" "${CUSTOM_JDBC[@]}" "${PLUGINS[@]}"; do
+for e in "${CUSTOM_JDBC[@]}" "${PLUGINS[@]}" "${STANDARD_JDBC[@]}" "${STANDARD_LIB[@]}"; do
 	CLASS_PATH="$CLASS_PATH:$e";
 done