This message was deleted.
# dependency-management
s
This message was deleted.
c
`a.b.c`are problematic here - would be cleaner if these were part of the module name, or published as variants.
1.+
will work - for any
a.b.c
which may not be appropriate.
m
so if artifact name and classifier both can't be used to store
a.b.c
I'm just screwed?
c
are those artifacts published with a classifier (
a.b.c
), or is that encoded as part of the version?
m
it's part of the version, the classifiers are
api
,
runtime
,
sources
, etc.
c
yea. Gradle will use x.y.z as the version and treat the rest as a qualifier. to my knowledge, the version resolution is smart - based on modelling the version - not a simple text matching.
you could pull in say
latest.release
, which would presumably match multiple qualifiers, and use the Gradle API to provide the right metadata to allow selection of the ‘right’
a.b.c
.
v
It is not simply possible, but what you could probably do is to have
2.+
and additionally a resolution rule that rejects any version with the wrong
a.b.c
.
m
How would I do that? I couldn't find any way to make constraints like that in the version{} block
v
You cannot
As I said, you need to combine a version constraint with a component selection rule
And it probably does not propagate to consumers, so will only work properly in an end product, not a library
Not without the consumer also having that component selection rule
m
If I used what you're suggesting, how would I make it work on existing configurations made by other plugins? (modApi, kapt, etc.) EDIT 1: After some testing, it seems I need to do
configurations.getByname("modApi").extendsFrom(this)
instead of the other way around? EDIT 2: It seems it's completely ignoring the configuration I gave it, I'm splitting the candidate.version on the "+" and reject if the last part is not a.b.c, but it seems to pick a.b.d as latest version instead EDIT 3:
Copy code
resolutionStrategy {
                componentSelection {
                    all {
                        throw RuntimeException(candidate.toString())
                    }
                }
            }
This does not log any errors, and it even still selects the version I'm trying to get it to not select... With some print debugging, I figured out that resolutionStrategy and componentSelection both run, but all never runs.
v
I wouldn't use
all
but
withModule
. And I don't know what you mean with the
extendsFrom
, that does not sound to be any related to your question. With
a.extendsFrom(b)
you configure that all dependencies declared for
b
are also declared for
a
. Just get the configurations you want the configuration on by name or just configure
configurations.all { ... }
if you want it for all configurations.