diff --git a/java-11-migration.patch b/java-11-migration.patch
new file mode 100644
index 0000000..5af5777
--- /dev/null
+++ b/java-11-migration.patch
@@ -0,0 +1,67 @@
+diff --git a/build.xml b/build.xml
+index 9c8ab7d..040318c 100644
+--- a/build.xml
++++ b/build.xml
+@@ -97,7 +97,7 @@ com.mysql.cj.extra.libs=<full_path_to_connector-j-jardeps>
+ # - Must point to JDK home directory.
+ # - Also used for testing if 'com.mysql.cj.testsuite.jvm' is not provided.
+ # - Mandatory.
+-com.mysql.cj.build.jdk=<full_path_to_jdk1.8>
++com.mysql.cj.build.jdk=<full_path_to_jdk11>
+
+ # Single JVM/MySQL tests:
+ # - Must point to JDK or JRE home directory.
+@@ -259,7 +259,7 @@ See also com.mysql.cj.conf.PropertyDefinitions.SYSP_* variables for other test o
+
+
+
+-
++
+
+
+
+@@ -352,12 +352,12 @@ See also com.mysql.cj.conf.PropertyDefinitions.SYSP_* variables for other test o
+
+
+
+-
++
+
+
+
+
+-
++
+
+
+
+@@ -385,7 +385,7 @@ See also com.mysql.cj.conf.PropertyDefinitions.SYSP_* variables for other test o
+
+
+
+-
++
+
+
+
+diff --git a/src/build/misc/rpm.spec.in b/src/build/misc/rpm.spec.in
+index d2926bb..9cf507b 100644
+--- a/src/build/misc/rpm.spec.in
++++ b/src/build/misc/rpm.spec.in
+@@ -84,13 +84,13 @@ BuildRequires: ant
+ %endif
+
+ %if 0%{!?with_java:1}
+-BuildRequires: java-devel >= 1:1.8.0
++BuildRequires: java-devel >= 1:11
+ %endif
+
+ %if 0%{?sles12:1} || 0%{?sles15:1}
+-Requires: java-headless >= 1.8.0
++Requires: java-headless >= 11
+ %else
+-Requires: java-headless >= 1:1.8.0
++Requires: java-headless >= 1:11
+ %endif
+
+ %description
diff --git a/mysql-connector-java.spec b/mysql-connector-java.spec
index c5459ca..c6f637a 100644
--- a/mysql-connector-java.spec
+++ b/mysql-connector-java.spec
@@ -2,7 +2,7 @@
Summary: Official JDBC driver for MySQL
Name: mysql-connector-java
Version: 8.0.25
-Release: 3%{?dist}
+Release: 4%{?dist}
Epoch: 1
License: GPLv2 with exceptions
URL: http://dev.mysql.com/downloads/connector/j/
@@ -32,6 +32,7 @@ Source0: %{name}-%{version}-nojars.tar.xz
Source1: generate-tarball.sh
Patch1: remove-coverage-test.patch
+Patch2: java-11-migration.patch
BuildArch: noarch
@@ -45,7 +46,7 @@ BuildRequires: javapackages-local
BuildRequires: junit5
BuildRequires: protobuf-java
BuildRequires: slf4j
-BuildRequires: java-1.8.0-openjdk-devel
+BuildRequires: java-11-openjdk-devel
Requires: slf4j
Requires: java
@@ -72,6 +73,7 @@ done
sed -i 's/>@.*>%{version}' src/build/misc/pom.xml
%patch1 -p1
+%patch2 -p1
%build
@@ -85,7 +87,7 @@ rm src/test/java/testsuite/regression/ConnectionRegressionTest.java
rm src/test/java/testsuite/regression/DataSourceRegressionTest.java
rm src/test/java/testsuite/simple/StatementsTest.java
-ant -Dcom.mysql.cj.build.jdk=/usr/lib/jvm/java-1.8.0-openjdk \
+ant -Dcom.mysql.cj.build.jdk=/usr/lib/jvm/java-11-openjdk \
-Dcom.mysql.cj.extra.libs=%{_javadir} \
test dist
@@ -100,6 +102,9 @@ ant -Dcom.mysql.cj.build.jdk=/usr/lib/jvm/java-1.8.0-openjdk \
%license LICENSE
%changelog
+* Wed Aug 18 2021 Ondrej Dubaj - 1:8.0.25-4
+- migrate to java-11
+
* Thu Jul 22 2021 Fedora Release Engineering - 1:8.0.25-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild