I've got a build.gradle (gradle version 8.6) that has
compileJava {
targetCompatibility = '21'
sourceCompatibility = '21'
}
dependencies {
implementation "com.microsoft.sqlserver:mssql-jdbc:12.6.1.jre11"
}
Running "gradle dependencies" shows a downgrade to '10.2.3.jre8':
+--- com.microsoft.sqlserver:mssql-jdbc:12.6.1.jre11 -> 10.2.3.jre8
There are no other dependencies which include mssql-jdbc.
If I enable strict version it does the same thing:
implementation("com.microsoft.sqlserver:mssql-jdbc") {
version {
strictly "$sqlServerConnectorVersion"
}
}
Result is the same downgrade.
+--- com.microsoft.sqlserver:mssql-jdbc:{strictly 12.6.1.jre11} -> 10.2.3.jre8
What am I missing here?
SOLUTION The solution to the problem is very specific to our project so I can't go into the details, but it involved gradle downgrading the version to 10.2.3.jre8 in a different sub-project which didn't need mssql-jdbc in the first place so we just excluded it.
ROOT CAUSE
This post here seems to be the root cause.
This could be happening because of some other dependency needing a lower version of the mssql-jdbc. Try running this command to get more info: