sbt / sbt

sbt, the interactive build tool
https://scala-sbt.org
Apache License 2.0
4.81k stars 937 forks source link

[0.13.7-M3] cached resolution does not respect dependencyOverrides #1684

Closed jasonchaffee closed 10 years ago

jasonchaffee commented 10 years ago

steps

  1. Make a build that uses "net.databinder" %% "unfiltered-uploads" % "0.8.0" (this brings in commons-io 1.4) with cached resolution enabled, and resolve it.
  2. Make another build that uses "net.databinder" %% "unfiltered-uploads" % "0.8.0" with cached resolution enabled and the following overrides:
    dependencyOverrides += "commons-io" % "commons-io" % "2.0"

problems

Resulting classpath includes commons-io 1.4.

expectation

When there are overrides, commons-io 2.0 is used.

original report

withCachedResolution(true) resolves dependencies differently than withCachedResolution(false) and I would expect them to resolve the same way, except for one is cached and one is not. I am getting several builds with odd behavior, only to find out the dependencies have been affected by trying to cache resolution to speed up the resolution.

I want to use the cache because I have approximately 1000 modules defined in dependencyOverrides so that I can lock down versions. Those don't seem to be honored if resolution cache is used.

I have attached a diff of just one application to show the different libraries that were included.

If you need specific SBT output, please tell me what you need and how to get it.

The diff patch file can be found here:

https://github.com/jasonchaffee/sbt-1684/blob/master/dependency-diff.patch

jasonchaffee commented 10 years ago

Also, I added a nice HTML diff page that shows the differences a little better. If you clone the repo, you will be able to access it.

git@github.com:jasonchaffee/sbt-1684.git

eed3si9n commented 10 years ago

Thanks for the report. It would be helpful if you could come up with a small example that can demonstrate the discrepancies. Is it mostly around overrides?

jasonchaffee commented 10 years ago

I will see about getting something more concrete. However, I know it is causing different resolutions if you don't use overrides as well, but if you use overrides they don't seem to be honored.

eed3si9n commented 10 years ago

I'm commandeering this issue for dependencyOverrides since it was clear cut to reproduce it. Please open another issue when you find discrepancies that does not involve overrides.