Reputation: 2814
So I have the following project structure with a play project, which is written in Java:
conf\
modules\
first\
app\
test\
second\
app\
test\
build.sbt
in my build.sbt I have the following
lazy val first= project.in(file("modules/first"))
.enablePlugins(PlayMinimalJava)
lazy val first= project.in(file("modules/second"))
.enablePlugins(PlayMinimalJava)
lazy val whole = project.in(file("."))
.enablePlugins(PlayMinimalJava)
.dependsOn(first, second)
Now, I would like to run the JUnit tests located in each subproject. When I put them at the root in test/
, they run if I do sbt test
. But if move them into the subprojects test directory -at modules/first/test/
and modules/second/test/
- they do not run.
What would be missing so my tests can run?
Upvotes: 1
Views: 117
Reputation: 509
You need to use aggregation. Here as quote from sbt docs
Aggregation means that running a task on the aggregate project will also run it on the aggregated projects.
Try using this
lazy val whole = project.in(file("."))
.aggregate(first, second)
.enablePlugins(PlayMinimalJava)
.dependsOn(first, second)
Upvotes: 1