Closed rob-elsevier closed 5 months ago
Perhaps a resolution strategy is rejecting all candidate versions?
Perhaps a resolution strategy is rejecting all candidate versions?
Thanks for the reply - I did try removing the whole section and still get the same error - it was previously as follows, but still get the same problem without it
dependencyUpdates {
checkForGradleUpdate = false
gradleReleaseChannel = 'current'
// Add a rule to reject pre-release versions and any we can not upgrade
resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['\\d-M\\d', '\\d-b\\d', '\\d-RC\\d', 'Alpha\\d', 'rc\\d', 'preview'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
}
That's a weird one! I see the same results but don't have any explanation for it. It is using Gradle's native features, so you can open an issue with them for help. Here is an example that fails for a dynamic version, +
.
plugins {
id 'java-library'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.microsoft.sqlserver:mssql-jdbc:+'
}
Then when you run gradle dependencies
it shows a failed resolution (trimmed, build scan).
------------------------------------------------------------
Root project 'gradle-versions-sample-groovy'
------------------------------------------------------------
compileClasspath - Compile classpath for source set 'main'.
\--- com.microsoft.sqlserver:mssql-jdbc:+ FAILED
implementation - Implementation only dependencies for source set 'main'. (n)
\--- com.microsoft.sqlserver:mssql-jdbc:+ (n)
runtimeClasspath - Runtime classpath of source set 'main'.
\--- com.microsoft.sqlserver:mssql-jdbc:+ FAILED
testCompileClasspath - Compile classpath for source set 'test'.
\--- com.microsoft.sqlserver:mssql-jdbc:+ FAILED
testRuntimeClasspath - Runtime classpath of source set 'test'.
\--- com.microsoft.sqlserver:mssql-jdbc:+ FAILED
The debug log shows that it is able to find the versions, but it is unclear why it failed to resolve any.
A Maven project did not have this problem, so it does not appear to be malformed metadata.
It looks like it failed on
2024-06-10T09:22:00.460-0700 [INFO] [org.gradle.internal.resource.transport.http.HttpClientHelper] Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/12.7.0/mssql-jdbc-12.7.0.pom]
The results do show that the files under that directory are misnamed (mssql-jdbc-12.7.0.jre11-preview.*
) which belong in their own version directories. I guess there is a bad release and it halts evaluation early when the repository does not contain the contents according to the maven-metadata.xml
versions file. It might be something to take to the mssql-jdbc team for why their release is not conforming to the Maven repository standards.
and if I use 12.6.+
then it resolves perfectly!
compileClasspath - Compile classpath for source set 'main'.
\--- com.microsoft.sqlserver:mssql-jdbc:12.6.+ -> 12.6.2.jre11
So there we go. Please open an issue with mssql-jdbc to fix their release process.
Looks like when they did their release they forgot to update to the correct naming
<!-- Use -preview for preview release, leave empty for official release. -->
<releaseExt>-preview</releaseExt>
They probably should have this as an env flag instead of a manual change. Their official release has preview in the file names. I'm not sure why Maven itself figures this out, but probably other build tools don't handle it very well and would be surprised in their artifact resolutions. I'd tell them about this since that dependency version is not usable in Gradle.
cc @barryw-mssql @tkyc @Jeffery-Wasty
I think the issue might be that we mistakenly released a 12.7.0 version with incorrect naming, and this is being recognized as the latest version. This is a mistake on our part, and unfortunately, we don't have any way of removing this release. We have a stable release (12.8) planned for July 31st, and plan on releasing a preview (12.7.1) sometime before that, but it looks like the above issue won't be resolved until these versions are released.
EDIT: Actually, now I'm not certain this would resolve things as the issue would continue to exist each time a pre-12.7 release is used. @rob-elsevier please create an issue on our repo so we can track this and work towards a solution (https://github.com/microsoft/mssql-jdbc)
Thank you @ben-manes and @Jeffery-Wasty really appreciate you digging into this. As requested I have raised the following ticket (pretty much just pointing to this ticket as you have already done a load of research here!!)
First off, thank you for making this plugin available!
I have one strange issue that I am struggling to get to the bottom of. I have the following dependency:
(Cut out some - but should give the idea)
And it is failing to find the mssql-jdbc for version checking:
But it's in the repo: https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc
Adding --info the output is:
Any help of suggestions would be appreciated. Thanks