Hi,
I noticed the changes made by @CedricChampeau in https://github.com/gradle/gradle/pull/6452 and wanted to follow-up with a question:
While it’s possible to force a component of a virtual platform, which will align the whole platform to that component’s version, how do I force this platform to a specific version, in a way that fails if there are transitives that require a higher version?
Given this code (on gradle-5.0-20180924235845+0000):
apply plugin: 'java-library'
dependencies {
components.all { ComponentMetadataDetails details ->
if (details.id.group.startsWith("com.fasterxml.jackson.")) {
details.belongsTo "com.fasterxml.jackson:platform:${details.id.version}"
}
}
// Let's assume these are transitives
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.3'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.0'
}
I know you can constrain one of the components of the platform and that will align the whole platform to that version:
dependencies {
constraints {
implementation "com.fasterxml.jackson.core:jackson-databind:2.9.5"
}
}
But I’d like to express this constraint in terms of the platform, without knowing ahead of time what components might be in the platform.
Is there a way to do that?
I’ve tried to add the platform itself as a constraint (platform or otherwise) but that makes gradle try to resolve it, so I’m guessing it no longer considers it a virtual platform:
dependencies {
constraints {
implementation enforcedPlatform("com.fasterxml.jackson:platform:2.9.5")
}
}
Thanks,
Dan