jvm-dependency-conflict-resolution icon indicating copy to clipboard operation
jvm-dependency-conflict-resolution copied to clipboard

Alignment rules

Open DreierF opened this issue 2 years ago • 4 comments

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 :)

DreierF avatar Jan 06 '23 15:01 DreierF

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 avatar Jan 09 '23 13:01 jjohannes

@jjohannes Friendly ping 🙂

DreierF avatar Apr 13 '23 07:04 DreierF

One year later 😄 I have changed my mind on this and have some new perspectives. I'll take a fresh look at this.

jjohannes avatar Jan 12 '24 06:01 jjohannes

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.

jjohannes avatar Apr 02 '24 09:04 jjohannes

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
}

jjohannes avatar May 31 '24 11:05 jjohannes

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)?

boris-petrov avatar Jun 03 '24 16:06 boris-petrov

Ugh. This looks like something is quite wrong there. Thanks for reporting @boris-petrov. I messed this up, including the test data ☹️

jjohannes avatar Jun 03 '24 16:06 jjohannes

Not a problem! :) Thanks again for the hard work on this great plugin!

boris-petrov avatar Jun 03 '24 16:06 boris-petrov

Fix in progress: #141

jjohannes avatar Jun 03 '24 16:06 jjohannes

@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.

jjohannes avatar Jun 04 '24 06:06 jjohannes

It works great! Thanks a lot for the quick fix!

boris-petrov avatar Jun 04 '24 15:06 boris-petrov