Reputation: 51
I am trying to setup a multi-project that includes a sub-project that does an import of a class that is defined in a Dependencies.scala file in its project directory. When I run sbt on the sub-project everything is fine but when I run sbt on the root project I get an error stating that Dependencies is not found. Here is my root build.sbt:
name := "sbtTest"
organization := "com.test"
version := "0.1"
lazy val foo = project
Here is foo's build.sbt:
import Dependencies._
name := "foo"
version := "0.2"
scalaVersion := "2.10.6"
Dependencies.scala is in foo/projects and here is the exact error I get:
/Users/xyz/git/sbtTest/foo/build.sbt:1: error: not found: object Dependencies
import Dependencies._
^
[error] Type error in expression
Has anyone run into this problem?
Upvotes: 0
Views: 612
Reputation: 62
In sbt you can also define all dependencies in a separated file. This file tends to be in /project/Dependencies.scala In the same directory than plugins.sbt.
Then import Dependencies._ can be easy imported in build.sbt file.
Upvotes: -1
Reputation: 1
I fixed this by making my build.sbt look like this..
lazy val otherProject = RootProject(file("../otherproject"))
lazy val rootProject = (project in file("."))
// dependsOn allows the root project to use functions from
.dependsOn(otherProject)
// aggregation runs tasks of root project on aggregated projects as well
.aggregate(otherProject)
Upvotes: 0