3
我试图建立多模块的开发环境与播放2.2.2和0.13.1 SBT播放2.2.2 SBT分项目和Scala
我的项目结构如下:
myProject
└ build.sbt
└ app - this code works perfect
└ modules
└ testModule
└ build.sbt
└ src
└ main
└ scala - here I have simple object Foo with method which returns string
└ test
└ scala - here is Spec2 test for Foo object with JUnitRunner
└ test - here is Spec2 tests for app and these tests also works fine
build.sbt在根目录中包含:在模块
import play.Project._
name := "FooBar"
version := "1.0"
playScalaSettings
lazy val main = project.in(file("."))
.dependsOn(testModule).aggregate(testModule)
lazy val testModule = project.in(file("modules/testModule"))
build.sbt只包含:
import play.Project._
name := "FooBar-module"
playScalaSettings
当我试图使用testModule中的代码时,编译器告诉我它甚至无法从该模块中找到包。同时在运行测试中,我得到了
没有测试,以testModule /试运行:测试
但如果我写testModule无效代码,我将开始从该模块出现错误,所以模块绝对编译。
这里有什么问题? SBT配置看起来正确
是的,我改变了目录,在playScalaSettings,一切工作 - 测试和应用程序!非常感谢! – ViLPy
关于.aggregate(testModule):如果在主项目上测试的情况下没有聚合,测试将不会在子项目上运行 – ViLPy
@ViLPy:哦,没有意识到。我会从问题中删除该部分。很高兴我能帮上忙。 –