New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AmbiguousConfigurationSelectionException with .module dependency #6389
Comments
I found a solution (workaround?) that involved creating a legacy variant usage context to attach to my root software component instance that allows a pom to be generated so that it will redirect to the default variant. I added two more files to the OP |
I think this issue is actually pretty severe now that more MPP projects are coming into the fold. This breaks kapt entirely for Kotlin projects right now if any MPP dependencies are on the kapt configuration (transitive or direct), and also breaks some other plugins when resolving configurations. Kapt issue filed here: https://youtrack.jetbrains.com/issue/KT-31641. Repro steps here https://youtrack.jetbrains.com/issue/KT-33206 Another gradle plugin example: ben-manes/gradle-versions-plugin#334 |
If I understand correctly the original question:
This clearly goes beyond the default I think the easiest path is to actually modify the generated POM file in the root module so that it references what you pick as the default variant to resolve. So effectively aiming for your gist modification but without the legacy variant appearing the The only thing I could see Gradle doing here is fail in the case you try publishing 2 variants with the exact same attributes. @ZacSweers I do not think the two issues are related. Here the problem is about creating the |
As mentioned in my comment, this is not just a kapt issue. A regular gradle plugin that tries to call |
I'll jump in the conversation on ben-manes/gradle-versions-plugin#334 to try to understand where the error is coming from exactly. And I confirm my initial analysis: the issue here is a publication one while the other issues linked are consumption ones. While it may require a fix at the publication site, it is much more likely that plugins will have to adapt to the upcoming features of variant aware dependency management, especially as leveraged by Kotlin MPP projects. |
@ljacomet just wanted to say thanks for the detailed explanations on both of the issues I linked above 👍. Hopefully they can get resolved soon with the added context, and apologies for the noise here |
Closing as extra validation was added in #10769 and there is no further plan on solving the particular use case described here in core Gradle. |
Expected Behavior
Projects that produce the a
.module
metadata file should be able to produce a backwards compatible pom file without causing ambiguity issues in the variant aware downstreams.Current Behavior
The consuming project gets stuck trying disambiguate between identical variant entries in the
.module
directory. The error message is also poor in that it shows the following:In this case there is two instances of
releaseApi
listed in the variants differing only by the download location, even though the artifact hash's are identical.Context
I am building a plugin to add variant aware and relatively pain free artifact publishing via the
maven-publish
gradle plugin. My downstream consumer only works when I omit a base level default configuration, this causes my base level pom file to be generated without dependencies listed.I could really use some better context on expected behavior of these types of publications. I think I may have thought of a solution as I type this up right now but it might be just a workaround not a solution.
Steps to Reproduce (for bugs)
88f6f6cdfaad36434ba3c43137d5f983c2c6bfa6
com.trevjonez.AndroidComponentsPluginTest.'app can consume lib'
Your Environment
.module
file currently generated: https://gist.github.com/trevjonez/2a8646a81f9beea158a1db828939906aThe text was updated successfully, but these errors were encountered: