我刚开始使用Scala和Play,我正在尝试使用sbt 0.13.5设置多重构建 我的项目结构如下:
/AnormCypher
-> /src
->/main
->/scala
->org.anormcypher[package]
->[Some classes]
-> [other dirs/files]
-> build.sbt
/sample
-> /src
->/main
->/scala
->/controllers[package]
->Application.scala
->[Some classes]
-> [other dirs/files]
-> build.sbt
示例项目取决于AnormCypher项目。我尝试在this SO post之后设置依赖项。样本中的build.sbt如下所示:
name := """sample"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
ws
)
lazy val core = ProjectRef(file("../AnormCypher"), "anormcypher")
val main = root.dependsOn(core)
当我进入我的控制台并输入
时activator
sbt能够加载项目。但是当我尝试编译源代码并尝试使用org.anormcypher包中的类时,它们无法解析:
object anormcypher is not a member of package org
[error] import org.anormcypher._
[error] ^
运行clean compile
也没有带来任何结果。
答案 0 :(得分:4)
更改
lazy val root = (project in file(".")).enablePlugins(PlayScala)
到
lazy val root = (project in file(".")).enablePlugins(PlayScala).dependsOn(core)
并删除
val main = root.dependsOn(core)
reload
,项目应该可以正常工作。