Robert Elliot
04/06/2022, 8:20 PM<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.26</version>
<classifier>android</classifier>
</dependency>
Note the <classifier>android</classifier>
- goodness knows why it's there, but it is 🤨.
Unfortunately upgrading jackson-dataformat-yaml
, whether transitively or otherwise, brings in org.yaml:snakeyaml:1.30
- and it seems that gradle (7.4.2) resolves that by creating a dependency on snakeyaml-1.30-android.jar
- which doesn't exist.
I can fix it as so:
implementation('com.github.javafaker:javafaker:1.0.2') { exclude group: 'org.yaml' }
but ideally I'd just quietly drop the android
classifier, rather than excluding the entire dependency, so that it would work if my other dependencies stop bringing in snakeyaml
.Robert Elliot
04/06/2022, 8:28 PMAnze Sodja
04/06/2022, 9:22 PMgrossws
04/07/2022, 3:43 AMRobert Elliot
04/07/2022, 7:15 AMJendrik Johannes
04/07/2022, 7:27 AMguice-noap
referenced by typesafeconfig-guice
. This is the rule that fixes the metadata of typesafeconfig-guice
and you could do smth similar for javafaker
:
/**
* Removes the 'no_aop' classifier from the Guice dependency, because it
* no longer exists with Guice 5.0 to which we upgrade the dependency.
*/
@CacheableRule
abstract class TypesafeConfigGuiceRule : ComponentMetadataRule {
companion object {
const val TYPESAFE_CONFIG_GUICE_MODULE = "com.github.racc:typesafeconfig-guice"
}
override fun execute(context: ComponentMetadataContext) {
context.details.allVariants {
withDependencies {
removeIf { it.group == "com.google.inject" }
add("com.google.inject:guice")
}
}
}
}
Jendrik Johannes
04/07/2022, 7:28 AM// register rule:
dependencies.components {
withModule<TypesafeConfigGuiceRule>(TypesafeConfigGuiceRule.TYPESAFE_CONFIG_GUICE_MODULE)
}
Niels Doucet
04/07/2022, 7:59 AM// javafaker requests the android variant of snakeyaml, which might not always exist
configurations {
configureEach {
resolutionStrategy {
eachDependency {
if (requested.name == "snakeyaml") {
artifactSelection {
selectArtifact("jar", "jar", null)
}
}
}
}
}
}
Jendrik Johannes
04/07/2022, 8:23 AM