How to make `sbt test` to run tests in main project and all subprojects (or some selected set)

大兔子大兔子 提交于 2019-12-23 02:00:11

问题


I have a main project and a few subprojects. When I want to run tests, currently I have to do sbt test and sbt subProjectName/test. Is there any way of making sbt run all tests or for example all tests in the main project and one of the subprojects.

I am using Build.scala configurations, but can't find a way of setting this.

Thanks!


回答1:


Therefore sbt supports aggregate.

for in depth details read: http://www.scala-sbt.org/0.13.5/docs/Getting-Started/Multi-Project.html#aggregation

In given example all commands at mainProject will also be run on other-project. So running mainProject/test will also run otherProject/test. If mainProject is your base project test will be enough.

in build.sbt

lazy val mainProject = 
   (project in file("."))
   .aggregate(otherProject)

lazy val otherProject = (project in file("other-project"))


来源:https://stackoverflow.com/questions/32884308/how-to-make-sbt-test-to-run-tests-in-main-project-and-all-subprojects-or-some

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!