0

Let's assume we have three projects (version in brackets):

A (0.0.1)
B (0.0.1), depends on A (0.0.1)
C (0.0.1), depends on B (0.0.1)

C depends on A & B.

Now we want to use this libraries as dependencies in our new project (D). So we add deps:

C (0.0.1)

Then we understand that A is missing some function, so we create it and increase version of A to 0.0.2 and add this dependency to D:

C (0.0.1)
A (0.0.2)

Sbt will complain about this deps when compiling D, something like

[warn] There may be incompatibilities among your library dependencies. [warn] Here are some of the libraries that were evicted: [warn] * A:0.0.1 -> 0.0.2

So i wonder, what's the best practice for cases like these? I thought that sbt knows about semantic versioning and understands that 0.0.1 is compatible with 0.0.2 and won't show any warnings.

Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64
  • Possible duplicate of [SBT: is it wise to fix eviction warnings of library dependencies](http://stackoverflow.com/questions/42520273/sbt-is-it-wise-to-fix-eviction-warnings-of-library-dependencies) – danielnixon Mar 27 '17 at 23:37

1 Answers1

1

I see 2 ways:

  1. When you increase A version, you also increase the version of A that B depends on:

    B (0.0.1), depends on A (0.0.2)

  2. Add SNAPSHOT to version:

    A (0.0.1-SNAPSHOT)

    B (0.0.1), depends on A (0.0.1-SNAPSHOT)

Also semantic versioning is not a strict rule and you can't rely on it completely because not all developers adhere to it that's why I think sbt warning is legal.

ka4eli
  • 5,294
  • 3
  • 23
  • 43