Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile a valid build #4165

Open
ckipp01 opened this issue Dec 19, 2024 · 6 comments
Open

Fails to compile a valid build #4165

ckipp01 opened this issue Dec 19, 2024 · 6 comments
Labels
bug The issue represents an bug upstream The issue originates in an upstream dependency

Comments

@ckipp01
Copy link
Contributor

ckipp01 commented Dec 19, 2024

I'm not really sure this is actually a Mill issue, but rather due to the recent changes in coursier. In my github-dependency-graph Mill plugin I came across a bug in coursier in the past about reconciled versions containing ranges. I added some hacks to work around it but recently with the pr to support the 0.12 series here I noticed that the behavior for this specific case changes a bit now and won't even compile when I believe it should. Given a minimal build like this:

import mill._, scalalib._

object minimalDep extends ScalaModule {
  def scalaVersion = "2.13.15"

  def ivyDeps = Agg(
    ivy"com.fasterxml.jackson.core:jackson-core:2.13.3"
  )
}

object minimal extends ScalaModule {
  def moduleDeps = Seq(minimalDep)

  def scalaVersion = "2.13.8"

  def ivyDeps = Agg(
    ivy"org.jongo:jongo:1.5.0"
  )
}

In earlier versions of Mill this would compile just fine. The reason I had this test is the jongo here wants a range of jackson data-bind [2.7.0,2.12.3] where jackson-core specifically wants 2.13.3. These should be compatible and 2.13.3 should be resolved and all should work fine. However, with 0.12.4 this no longer compiles:

[84/84] ============================== __.compile ============================== 3s
1 tasks failed
minimal.resolvedIvyDeps coursier.error.ResolutionError$ConflictingDependencies: Conflicting dependencies:
com.fasterxml.jackson.core:jackson-core:2.12.3 or [2.7.0,2.12.3] wanted by

  com.fasterxml.jackson.core:jackson-databind:2.12.3 wants 2.12.3
  └─ org.jongo:jongo:1.5.0 wants com.fasterxml.jackson.core:jackson-databind:[2.7.0,2.12.3]

  org.jongo:jongo:1.5.0 wants [2.7.0,2.12.3]


    mill.util.CoursierSupport.resolveDependenciesMetadataSafe(CoursierSupport.scala:312)
    mill.util.CoursierSupport.resolveDependenciesMetadataSafe$(CoursierSupport.scala:249)
    mill.util.Jvm$.resolveDependenciesMetadataSafe(Jvm.scala:15)
    mill.util.CoursierSupport.resolveDependenciesMetadataSafe(CoursierSupport.scala:339)
    mill.util.CoursierSupport.resolveDependenciesMetadataSafe$(CoursierSupport.scala:320)
    mill.util.Jvm$.resolveDependenciesMetadataSafe(Jvm.scala:15)
    mill.util.CoursierSupport.resolveDependencies(CoursierSupport.scala:80)
    mill.util.CoursierSupport.resolveDependencies$(CoursierSupport.scala:56)
    mill.util.Jvm$.resolveDependencies(Jvm.scala:15)
    mill.scalalib.Lib$.resolveDependencies(Lib.scala:158)
    mill.scalalib.CoursierModule$Resolver.resolveDeps(CoursierModule.scala:216)
    mill.scalalib.JavaModule.$anonfun$resolvedIvyDeps$3(JavaModule.scala:779)
coursier.error.ResolutionError$ConflictingDependencies: Conflicting dependencies:
com.fasterxml.jackson.core:jackson-core:2.12.3 or [2.7.0,2.12.3] wanted by

  com.fasterxml.jackson.core:jackson-databind:2.12.3 wants 2.12.3
  └─ org.jongo:jongo:1.5.0 wants com.fasterxml.jackson.core:jackson-databind:[2.7.0,2.12.3]

  org.jongo:jongo:1.5.0 wants [2.7.0,2.12.3]

Shouldn't these be compatible, 2.12.3 be resolved, and all compile fine?

@lefou
Copy link
Member

lefou commented Dec 19, 2024

I think this should resolve properly. Is this with Mill 0.12.4? Could you please verify, if this works with Mill 0.12.3? It is likely related to #3924. @alexarchambault Do you have an idea?

@ckipp01
Copy link
Contributor Author

ckipp01 commented Dec 19, 2024

I think this should resolve properly. Is this with Mill 0.12.4? Could you please verify, if this works with Mill 0.12.3? It is likely related to #3924. @alexarchambault Do you have an idea?

So it looks like this broke in general with the 0.12.x series. I confirmed that it works with 0.11.13, but not with 0.12.0 and onwards.

@alexarchambault
Copy link
Contributor

I think we're seeing two things here:

  • since 0.12 and Use coursier 2.x API #3513, we report such conflicts (the coursier 2.x API handles that for us). Mill <= 0.11 used to trap those conflicts
  • [2.7.0,2.12.3] and 2.12.3 ought to be compatible, indeed. That looks like a bug in coursier.

@alexarchambault
Copy link
Contributor

alexarchambault commented Dec 19, 2024

@ckipp01 In the build example above, you're using 2.13.3 as a version for jackson-core. That's a typo, right? You meant 2.12.3? I can't reproduce the conflict with 2.12.3 on the command-line (I can't reproduce there the bug you seem to be running into)

@alexarchambault
Copy link
Contributor

I would say the bug is in the conflict message of coursier, not in the resolver itself:

$ cs resolve com.fasterxml.jackson.core:jackson-core:2.12.3 org.jongo:jongo:1.5.0
com.fasterxml.jackson.core:jackson-annotations:2.12.3:default
com.fasterxml.jackson.core:jackson-core:2.12.3:default
com.fasterxml.jackson.core:jackson-databind:2.12.3:default
de.undercouch:bson4jackson:2.12.0:default
org.jongo:jongo:1.5.0:default

$ cs resolve com.fasterxml.jackson.core:jackson-core:2.13.3 org.jongo:jongo:1.5.0
Resolution error: Conflicting dependencies:
com.fasterxml.jackson.core:jackson-core:2.12.3 or [2.7.0,2.12.3] wanted by

  com.fasterxml.jackson.core:jackson-databind:2.12.3 wants 2.12.3
  └─ org.jongo:jongo:1.5.0 wants com.fasterxml.jackson.core:jackson-databind:[2.7.0,2.12.3]

  org.jongo:jongo:1.5.0 wants [2.7.0,2.12.3]

(it should have printed com.fasterxml.jackson.core:jackson-core:2.13.3 rather than com.fasterxml.jackson.core:jackson-core:2.12.3 in the second run)

@lefou lefou added bug The issue represents an bug upstream The issue originates in an upstream dependency labels Dec 19, 2024
@ckipp01
Copy link
Contributor Author

ckipp01 commented Dec 19, 2024

@ckipp01 In the build example above, you're using 2.13.3 as a version for jackson-core. That's a typo, right? You meant 2.12.3? I can't reproduce the conflict with 2.12.3 on the command-line (I can't reproduce there the bug you seem to be running into)

ahhhh actually I did have 2.13.3 correctly, but was confused by the error message. The range is actually incompatible with 2.13.3, but I was focused on the error message which makes it seem like 2.12.3. So I guess this isn't an error here with Mill, or really an error at all in logic, just a confusing error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue represents an bug upstream The issue originates in an upstream dependency
Projects
None yet
Development

No branches or pull requests

3 participants