执行 sbt 任务命令时看不到 jacoco 任务(-v 也试过了)

Cannot see jacoco task when executing sbt tasks command (-v is tried as well)

我正在尝试使用 jacoco 将测试报告集成到我的 sbt 项目中。 https://github.com/sbt/jacoco4sbt

我将 jacoco.settings 添加到 build.sbt

我还将addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.6")添加到plugins.sbt

当我 运行 sbt jacoco:check 时,它工作正常。但是,当我尝试查看 jacoco 有多少任务时,sbt tasks 没有显示与 jacoco 相关的任何内容。

我得去源码看看

https://github.com/sbt/jacoco4sbt/blob/master/src/main/scala/de/johoop/jacoco4sbt/Keys.scala

我可以知道为什么 sbt tasks 命令没有显示 jacoco 吗?查看插件所有可用任务的最佳方式是什么

编辑:

我怀疑语句 lazy val Config = config("jacoco") extend(Test) hide 意味着 jacoco 扩展了测试任务,所以它不会在 sbt 任务中显示它,但我不确定。

来自 运行宁

> tasks -v

Edit: If that doesn't work consider adding more "v"s, such as tasks -vvv, or even tasks -V to see all the tasks.

我明白了,例如,cover:

This is a list of tasks defined for the current project.
It does not list the scopes the tasks are defined in; use the 'inspect' command for that.
Tasks produce values.  Use the 'show' command to run the task and print the resulting value.

  check                  Executes the tests and saves the execution data in 'jacoco.exec'.
  classesToCover         compiled classes (filtered by includes and excludes) that will be covered
  clean                  Cleaning JaCoCo's output-directory.
  compile                Compiles sources.
  console                Starts the Scala interpreter with the project classes on the classpath.
  consoleProject         Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.
  consoleQuick           Starts the Scala interpreter with the project dependencies on the classpath.
  copyResources          Copies resources to the output directory.
  cover                  Executes the tests and creates a JaCoCo coverage report.
  coveredSources         Covered Sources.

另请注意它开头所说的内容(为清楚起见包裹起来):

It does not list the scopes the tasks are defined in;
  use the 'inspect' command for that.

这导致

> inspect cover
[info] No entry for key.
[info] Description:
[info]  Executes the tests and creates a JaCoCo coverage report.
[info] Delegates:
[info]  *:cover
[info]  {.}/*:cover
[info]  */*:cover
[info] Related:
[info]  jacoco:cover

所以你知道 运行 jacoco:cover