user504909
user504909

Reputation: 9559

How can project/Build.scala use value defined in build.sbt?

I try to use Build.scala build multi-projects. This is my files directory:

MyMainPro/
   app/
       controls/
       models/
       views/
   conf/
       <some files>
   modules/
       anotherProject/
             app/
                 controles/
                 models/
                 views/
             conf/
                 <some files>
             build.sbt
   project/
       <project build files>
       Build.scala
   <other directories>

I want invoke the variable inside the build.sbt from my outer Build.scala file. Is that Possible? How to do it.

For instance, my inner build.sbt have a project object:

lazy val pil = (project in file(".")).enablePlugins(PlayScala).settings(scalaVersion := "2.11.2")

How to invoke this project from my outer Build.scala file? I want to do similar like:

lazy val root  = Project(appName, base = file(".")).enablePlugins(play.PlayScala)
.dependsOn(sil)

I just want to build my project depend on some OpenSource projects and want to change part of their source code.

I read the http://www.scala-sbt.org/0.13/tutorial/Multi-Project.html It is only contain how to get varieties from Build.scala to build.sbt. I want to do the opposite action. That is get varieties from buid.sbt to Build.scala.

Upvotes: 1

Views: 634

Answers (1)

Alexey Romanov
Alexey Romanov

Reputation: 170859

No, you can't use values from build.sbt. But for this case you don't need to; just write

lazy val root  = Project(appName, base = file(".")).enablePlugins(play.PlayScala).
  dependsOn(RootProject(file("modules/anotherProject")))

(see this answer for more information on source dependencies).

Upvotes: 2

Related Questions