如何使“ sbt test”在主项目和所有子项目(或某些选定的集合)中运行测试 [英] How to make `sbt test` to run tests in main project and all subprojects (or some selected set)

查看:211
本文介绍了如何使“ sbt test”在主项目和所有子项目(或某些选定的集合)中运行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主项目和几个子项目。当我想运行测试时,当前必须执行 sbt测试 sbt subProjectName / test 。有什么方法可以使sbt运行所有测试,例如运行在主项目和一个子项目中的所有测试。

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.

我正在使用Build.scala配置,但是可以

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

谢谢!

推荐答案

因此, sbt 支持聚合

详细信息请阅读: http:// www .scala-sbt.org / 0.13.5 / docs / Getting-Started / Multi-Project.html#aggregation

在给定的示例中,所有位于 mainProject 也将在 other-project 上运行。
因此,运行 mainProject / test 也会运行 otherProject / test
如果 mainProject 是您的基础项目, test 就足够了。

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.

build.sbt

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

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

这篇关于如何使“ sbt test”在主项目和所有子项目(或某些选定的集合)中运行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆