Search code examples
pluginsplayframeworksbt

How can I get a reference to current project in a sbt subproject build.sbt file


I have a playframework subproject. Currently I'm defining it as a playframework module in the parent build.sbt

lazy val silhouetteModule = (project in file("modules/silhouette"))
    .enablePlugins(PlayScala)

I would prefer to delegate that knowledge to the child project build.sbt. How can I call in the child project this enablePlugins?

import play.PlayScala

scalaVersion := "2.11.1"

name := "play-silhouette-seed"

version := "1.0"

libraryDependencies ++= Seq(
  "com.mohiva" %% "play-silhouette" % "1.0",
  "org.webjars" %% "webjars-play" % "2.3.0",
  "org.webjars" % "bootstrap" % "3.1.1",
  "org.webjars" % "jquery" % "1.11.0",
  "net.codingwell" %% "scala-guice" % "4.0.0-beta4",
  cache
)

//this doesn't work
currentThisProject.enablePlugins(PlayScala)

Solution

  • You can call enablePlugins directly in your build.sbt file for the subproject:

    enablePlugins(PlayScala)