From 6ee3e24fb7b602c3672fab10c964475b7f27315d Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Mon, 3 Jan 2022 08:58:31 +0100 Subject: [PATCH] Declare com.microsoft.azure:adal4j dependency as optional The `quarkus-jdbc-mssql` extension has a dependency on `com.microsoft.azure:adal4j`, which apparently is required for compilation to succeed. To allow Quarkus applications to work with newer versions of `com.microsoft.sqlserver:mssql-jdbc` (currently not possible in Quarkus, because newer versions have issues with native mode), this dependency is declared as optional, since the newer versions have replaced this dependency with `com.azure:azure-identity` to support Active AD based authentication. Also note that this dependency is also declared as optional by the `mssql-jdbc` module and that a Quarkus application unfortunately cannot work with Maven exclusions to exclude the dependency when imported via the Quarkus BOM. --- extensions/jdbc/jdbc-mssql/runtime/pom.xml | 2 ++ .../microsoft/sqlserver/jdbc/SQLServerJDBCSubstitutions.java | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/jdbc/jdbc-mssql/runtime/pom.xml b/extensions/jdbc/jdbc-mssql/runtime/pom.xml index ee5361d3406a0..e1ff0b97c383c 100644 --- a/extensions/jdbc/jdbc-mssql/runtime/pom.xml +++ b/extensions/jdbc/jdbc-mssql/runtime/pom.xml @@ -30,11 +30,13 @@ com.microsoft.azure adal4j 1.6.6 + true org.apache.commons diff --git a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/graal/com/microsoft/sqlserver/jdbc/SQLServerJDBCSubstitutions.java b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/graal/com/microsoft/sqlserver/jdbc/SQLServerJDBCSubstitutions.java index 505f48c02a14e..9bda102be1742 100644 --- a/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/graal/com/microsoft/sqlserver/jdbc/SQLServerJDBCSubstitutions.java +++ b/extensions/jdbc/jdbc-mssql/runtime/src/main/java/io/quarkus/jdbc/mssql/runtime/graal/com/microsoft/sqlserver/jdbc/SQLServerJDBCSubstitutions.java @@ -46,6 +46,8 @@ private QuarkusSqlFedAuthToken getMSIAuthToken(String resource, String msiClient } -class SQLServerJDBCSubstitutions { +@TargetClass(className = "com.microsoft.aad.adal4j.AuthenticationException") +@Substitute +final class AuthenticationExceptionSubstitutions { } \ No newline at end of file