Fix resolution of Java Usage artifacts for configurations with no usage
When Gradle resolves a dependency on a publication with no metadata (or with metadata disabled), it represents it as two variants, one with Usage `java-api`, the other with `java-runtime`. It turns out that the `java-api` one does not contain transitive dependencies with Maven scope `runtime`. This commit makes the Kotlin Gradle plugin disambiguation rules behave the same way as those defined in the JavaBasePlugin: when no Usage is requested, prefer the runtime usages as they are more complete.
This commit is contained in:
+2
-2
@@ -71,10 +71,10 @@ object KotlinUsages {
|
||||
details.closestMatch(candidateValues.single { it?.name == KOTLIN_RUNTIME }!!)
|
||||
}
|
||||
if (JAVA_API in candidateNames && JAVA_RUNTIME_JARS in candidateNames && values.none { it in candidateNames }) {
|
||||
details.closestMatch(candidateValues.single { it?.name == JAVA_API }!!)
|
||||
details.closestMatch(candidateValues.single { it?.name == JAVA_RUNTIME_JARS }!!)
|
||||
}
|
||||
if (JAVA_API in candidateNames && JAVA_RUNTIME in candidateNames && values.none { it in candidateNames }) {
|
||||
details.closestMatch(candidateValues.single { it?.name == JAVA_API }!!)
|
||||
details.closestMatch(candidateValues.single { it?.name == JAVA_RUNTIME }!!)
|
||||
}
|
||||
if (JAVA_RUNTIME_CLASSES in candidateNames && JAVA_RUNTIME_RESOURCES in candidateNames && KOTLIN_RUNTIME in candidateNames) {
|
||||
closestMatch(candidateValues.single { it?.name == KOTLIN_RUNTIME }!!)
|
||||
|
||||
Reference in New Issue
Block a user