Reputation: 1820
I started to use a project/Settings.scala to help clean up my main build.sbt. This is a scalajs project with Play backend where I use Play's WS & Cache dependencies. In built.sbt the 'string/keyword/' <-not sure correct term here but ws
and cache
properly resolve. However in my Seq[String]
in Settings.scala
where I store my server library dependencies they won't. Currently I am using
libraryDependencies ++= Seq(ws, cache) ++ Settings.jvmDependencies.value,
which works but it makes me wonder how I might be able to move everything to Settings or if that is possible. When I dig one layer deeper in IDE I see for example ws is defined as :
val ws : sbt.ModuleID = { /* compiled code */ }
in the object PlayImport
but I can't see the proper values to populate a full/typical dependency definition for sbt
Ultimately I am curious can I successfully export ws
& cache
such that I can have this line in my build.sbt
libraryDependencies ++= Settings.jvmDependencies.value,
Upvotes: 0
Views: 46
Reputation: 4431
If you want to have all the Play symbols in your plugin - which is what your project/Settings.scala
file is - just import the fields from the Play plugin's autoImport
member:
import play.sbt.Play.autoImport._
This will let you use ws
, cache
, and any other symbols the plugin exposes.
Upvotes: 1
Reputation: 11318
You can have a direct look at the Play SBT plugin sources, it's usually the easiest way. Here's how the ws
defined:
val ws = component("play-ahc-ws")
where component
is defined in the same file like this:
def component(id: String) = "com.typesafe.play" %% id % play.core.PlayVersion.current
With this information we know the ws
dependency amounts to "com.typesafe.play" %% "play-ahc-ws" % "2.5.10"
for the current Play version.
Upvotes: 1