Question

Lets say I create a binary compatible update of my library foo from version 1.0.0 to 1.0.1. Library foo is published via Maven.

Can I use this minor version update to bump at the same time the minor versions of the dependencies of foo? For example, version 1.0.0 was using scalaVersion := "2.10.1". Can I change that to scalaVersion := "2.10.3" in foo 1.0.1, or will that cause trouble?

Assume that I use foo in another project as

"mygroup" %% "foo" % "1.0.+"
Was it helpful?

Solution

There are several considerations involved, but generally yes, you can change the versions of dependencies if they are binary compatible. The Scala team aims for 2.10.x releases to be binary compatible. You can compile against Scala 2.10.1 and use 2.10.3 at runtime.

You can generally do the reverse for the Scala library as long as you use methods and types that are present in both. Most libraries aren't concerned with this direction, though. Other caveats on binary compatibility:

  • Different libraries have different policies on what version bumps mean.
  • Libraries may or may not have automation to check binary compatibility.
  • Automation like MiMa (used by Scala) does not catch all kinds of incompatibilities. For example, MiMa only catches "syntactic" incompatibilities (ones that throw LinkageErrors at runtime).
  • Binary compatibility does not imply source compatibility.

It is not generally recommended to use dynamic revisions like "1.0.+", however. They make reproducing builds harder as well as affecting resolution speed.

OTHER TIPS

Generally modern software follows semantic versioning

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

So "2.10.3" is to be compatible with any "2.10.x" version.

Usually we should not care about .PATCH part, except for cases when a bug affecting our code was fixed. And I guess that is the case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top