Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playframework 2.3.9 dependency override

As of Play 2.3, Play is added as an SBT Plugin as follows in my Build.scala as follows:

Project("root", file(".")).enablePlugins(play.PlayScala)

Also have a look at the documentation.

I need a specific dependeny updated, namely Fluentlenium (Play 2.3.9 still uses 0.9.3):

"org.fluentlenium" % "fluentlenium-core" % "0.10.3"

How can I replace the old version and replace it with a newer one? Simply adding the library to the libraryDependencies leaves me with both versions in the class path.


Edit: After digging a bit deeper, it seems as if the (new?) feature of dependencyOverrides that comes with SBT 13.8 could be a solution:

Overriding a version. But also have a look at Conflict Management from the very same documentation.

With this you can override single dependencies, which means that you have to override each transititve dependency manually.

like image 307
mana Avatar asked Nov 10 '22 13:11

mana


1 Answers

Simply adding the library to the libraryDependencies leaves me with both versions in the class path.

Are you sure about this? sbt (Ivy) should evict the older one if there are multiple versions in the same configuration.

In most cases

libraryDependencies += "org.fluentlenium" % "fluentlenium-core" % "0.10.3"

should be ok, granted that 0.9.x are binary compatible with 0.10.x. If you want to make sure that it is overridden during transitive dependency resolution, dependencyOverrides might be the way to go:

dependencyOverrides += "org.fluentlenium" % "fluentlenium-core" % "0.10.3"
like image 53
Eugene Yokota Avatar answered Dec 21 '22 12:12

Eugene Yokota