An undefined variable used by `enablePlugins` method?

214 views Asked by At

My build.sbt looks like this:

lazy val root = (project in file(".")).enablePlugins(PlayScala)


name := "slick"

version := "1.0"

scalaVersion := "2.11.4"

libraryDependencies ++= Seq(
  "com.typesafe.slick" %% "slick" % "2.1.0",
  "org.postgresql" % "postgresql" % "9.3-1102-jdbc4",
  "org.slf4j" % "slf4j-simple" % "1.6.4"
)

And the project/plugins.sbt looks like this:

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

In the first line of my build.sbt, I saw codes like this:

lazy val root = (project in file(".")).enablePlugins(PlayScala)

What I can't understand is the PlayScala, which should be an undefined variable. But when I use sbt to build the project, sbt didn't complain about this. Does anyone have ideas about this?

1

There are 1 answers

0
Eugene Yokota On BEST ANSWER

What I can't understand is the PlayScala, which should be an undefined variable.

See Controlling the import with autoImport.

When an auto plugin provides a stable field such as val or object named autoImport, the contents of the field are wildcard imported in set, eval, and .sbt files.