I would like to share a common version variable between an sbtPlugin and the rest of the build
Here is what I am trying:
in project/Build.scala:
For the project/plugins.sbt file you'd have to have another project under project with the Versions.scala file. That would make the definition of Versions.scalaJs visible.
The reason for doing it is that *.sbt files belong to a project build definition at the current level with *.scala files under project to expand on it. And it's...turtles all the way down, i.e. sbt is recursive.
I'm not sure how much the following can help, but it might be worth to try out - to share versions between projects - plugins and the main one - you'd have to use ProjectRef as described in the answer to RootProject and ProjectRef:
When you want to include other, separate builds directly instead of using their published binaries, you use "source dependencies". This is what
RootProjectandProjectRefdeclare.ProjectRefis the most general: you specify the location of the build (a URI) and the ID of the project in the build (a String) that you want to depend on.RootProjectis a convenience that selects the root project for the build at the URI you specify.