Slackbot
10/16/2023, 2:31 PMVampire
10/16/2023, 2:34 PMdependencyInsight or a build --scan?
Both should at least display which variant with which attributes were resolved.
Can you maybe knit an MCVE, so that it is clear what we are talking about in detail?Chris
10/16/2023, 2:37 PMChris
10/16/2023, 2:57 PMChris
10/16/2023, 3:48 PM> Could not resolve all files for configuration ':runtimeClasspath'.
> The consumer was configured to find sources. However we cannot choose between the following variants of org.ehcache.modules:ehcache-xml:3.10.8:
- org.ehcache.modules:ehcache-xml:3.10.8 variant sourcesElements declares sources:
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
- Provides its dependencies declared externally but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides runtime but the consumer didn't ask for it
- org.ehcache.modules:ehcache-xml:3.10.8 variant jakartaSourcesElements declares sources:
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
- Provides its dependencies declared externally but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Provides release status but the consumer didn't ask for it
- Provides runtime but the consumer didn't ask for itChris
10/16/2023, 3:49 PMChris
10/16/2023, 5:19 PMVampire
10/16/2023, 9:26 PMconfigurations.create("sourceFiles") {
extendsFrom(configurations.runtimeClasspath.get())
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named<Category>(Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named<DocsType>(DocsType.SOURCES))
}
}.incoming.artifactView {
}.files.forEach {
println("Source File: $it")
}
You also have an aftifact view there. 😄
I guess the relevant point is the JavaDoc of withVariantReselection() which says
When invoked, this view will disregard existing attributes of its parent configuration and re-resolve the artifacts using only the attributes in the view's attribute container.I'm not sure though, whether it is intended, that also the attributes on the dependencies are discarded. I personally would say that this might not be intended and would recommend reporting it as bug. But my (and obviously your) expectations could of course also be wrong.
Chris
10/16/2023, 9:37 PMChris
10/16/2023, 9:38 PMVampire
10/16/2023, 9:55 PM