Overriding the dependencies of plugins happens the same way as overriding normal dependencies, except that the configuration must be entered into project/plugins.sbt
. Overriding dependencies is explained in Library Management. Here is a summary:
If the version you wish to use is greater than the dependency that you would get transitively, sbt will use the larger version by default. You may change the conflict manager to change the default behavior - for example this will create an error on conflict:
conflictManager := ConflictManager.strict
In other words, this in project/plugins.sbt
would work:
libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.6.400"
You may check your plugin dependencies using reload plugins
and then show update
. It should now show the older version as "(EVICTED)".
If the version you wish to use is lower than the default dependency, then you will need to override differently. One way is to force the dependency:
libraryDependencies += "fi.jumi" % "jumi-launcher" % "0.4.350" force()
Another way is to use the dependencyOverrides
setting:
dependencyOverrides += "fi.jumi" % "jumi-launcher" % "0.4.350"
The difference between the two methods is that overriding doesn't introduce a direct dependency. I don't think the difference matters for plugins, but for published artifacts it has some differences.
0.3
| day1 : I publish locally my in-development plugin with version0.4
and reference this plugin with a local repository | day 2 : the plugin is published with version0.4
on internet official repo | day 3 : my plugin does not do what I expect anymore because sbt load both plugins but decide to take the one from internet. To workaround the issue I had to change my version to0.5
and then it worked. – Selfpity