0

Recently the Finagle library started depending on a custom fork of libthrift as "com.twitter" % "libthrift". The regular one is "org.apache.thrift" % "libthrift". Both contain the same classes in the same package.

While it is possible to manually clean up the classpath, it might be something that not every developer will be aware of in the future - especially through transient dependencies.

We have developed an internal SBT plugin, that all our projects are using, that can be used for shared settings. I am looking for a clever way to tell SBT, that a dependency is just an alias. During dependency resolution, ideally it would treat both ModuleID's as if they had the same organisation (aliased).

Justin Kaeser
  • 5,868
  • 27
  • 46
reikje
  • 2,850
  • 2
  • 24
  • 44

1 Answers1

1

The trouble is that the user's libraryDependencies will have precedence over any overrides in your plugin. What might work is overriding allDependencies:

allDependencies :=
  allDependencies.value.map { module =>
    if (module.organization == "org.apache.thrift" && module.name == "libthrift")
      module.copy(organization = "com.twitter")
    else module
  }
Justin Kaeser
  • 5,868
  • 27
  • 46