Reputation: 73
I'm trying to setup multi-module dev environment with Play 2.2.2 and SBT 0.13.1
My project structure looks like this:
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 in the root contains:
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 in module contains only:
import play.Project._
name := "FooBar-module"
playScalaSettings
When I'm trying to use code from testModule, compiler told me that it cannot find even packages from this module. Also while running tests I got
No tests to run for testModule/test:test
But if I write invalid code in testModule, I will start to get errors from this module, so module is definitely compiled.
What could be a problem here? SBT config looks correct
Upvotes: 3
Views: 424
Reputation: 5426
playScalaSettings
contains settings for most of the paths. This includes that the test source are set to the path /test
(See default settings in doc). In your layout however, the test sources are located in src/test
. So sbt will not look for these files in test.
If your module is a play project then either change the folder layout accordingly or configure the paths to match your layout. If not remove the playScalaSettings
line.
You can set the test source path like this:
scalaSource in Test <<= baseDirectory / "src" / "test" / "scala"
Upvotes: 2