0
我有一個sbt項目與多個模塊,每個都有自己的build.sbt
文件。sbt多模塊項目從另一個模塊導入特徵
在根項目,我有以下幾點:
lazy val commonSettings = Seq(
organization := "com.game.scala",
sourcesInBase := false,
fork in run := true,
scalaVersion := "2.12.1"
)
lazy val common = project.settings(commonSettings)
lazy val original = project.settings(commonSettings).dependsOn(common)
lazy val functional = project.settings(commonSettings).dependsOn(common)
lazy val root = (project in file("."))
.aggregate(original, functional)
.settings(commonSettings)
的build.sbt在所有子模塊都幾乎是相同的:
lazy val module = (project in file("."))
.settings(
name := "Game subpart",
version := "0.1.0-SNAPSHOT"
)
和項目的佈局看起來是像:
root
|__ common
|__ original
|__ functional
問題是,從functional
模塊內,我F I嘗試導入在common
模塊聲明的特質,我得到一個錯誤,這是不可用:
Error:(1, 12) object game is not a member of package com
import com.game.scala
我缺少什麼?
感謝您的回答,但沒有解決問題。無論如何,sbt給了我足夠的頭痛,我決定改用gradle – smac89