jvm-dependency-conflict-resolution
jvm-dependency-conflict-resolution copied to clipboard
Alignment rules
Hi @jjohannes,
I added some additional rules along the lines of https://blog.gradle.org/alignment-with-gradle-module-metadata to align Jetty, Jersey, Asm and Apache SSHD dependency versions.
Let me know what you think :)
Thanks again for contributing @DreierF! I think it makes sense to add such rules as well.
I will have a look at the changes soon. I plan to invest some time to address the issues and prepare a new release in the next days.
@jjohannes Friendly ping 🙂
One year later 😄 I have changed my mind on this and have some new perspectives. I'll take a fresh look at this.
Release 2.0 will have alignment rules ported from logging-capabilities. After the release is out, we can update this PR to add the rules sketched here using the same structure as the logging alignment rules.
I reworked this to add the alignment as we do for other (logging) libraries already.
I used this hacky piece of Gradle script to get all entries from an existing BOM that I then copy-pasted into AlignmentDefinition:
// val bom = "org.eclipse.jetty:jetty-bom:12.0.9"
// val bom = "org.ow2.asm:asm-bom:9.7"
val bom = "org.glassfish.jersey:jersey-bom:3.1.7"
val generateAlignment = configurations.create("generateAlignment")
dependencies {
generateAlignment(platform(bom))
components {
withModule(bom.substring(0, bom.lastIndexOf(":"))) {
withVariant("platform-runtime") {
println(this)
withDependencyConstraints {
forEach {
println("\"${it.group}:${it.name}\",")
}
}
}
}
}
}
tasks.register("generateAlignment") {
generateAlignment.files
}
I'm not quite sure what this commit does but I guess it's the one that breaks my build after upgrading to 2.1. I get:
Could not find org.eclipse.jetty:jetty-bom:2.43.
Required by:
project :shared > org.glassfish.jersey.core:jersey-server:2.43
project :shared > org.glassfish.jersey.core:jersey-server:2.43 > org.glassfish.jersey.core:jersey-common:2.43
project :shared > org.glassfish.jersey.core:jersey-server:2.43 > org.glassfish.jersey.core:jersey-client:2.43
Which doesn't make sense as that version of Jetty does not exist. I have a platform dependency on org.glassfish.jersey:jersey-bom:2.43 and checking the dependency-tree of my app - there is an org.eclipse.jetty:jetty-bom:2.43 under all Jersey artifacts. This is not true when I use version 2.0.
Am I doing something wrong or is this a bug in this commit (or somewhere else in v2.1)?
Ugh. This looks like something is quite wrong there. Thanks for reporting @boris-petrov. I messed this up, including the test data ☹️
Not a problem! :) Thanks again for the hard work on this great plugin!
Fix in progress: #141
@boris-petrov published 2.1.1 with the fix. Let me know if you find any other unexpected behavior. Thanks for the prompt testing and feedback.
It works great! Thanks a lot for the quick fix!