dade
dade

Reputation: 3570

How to show the result of an SBT task in Console

In sbt console, it is possible to do show settingsKey to view the value of a setting for example:

> show resourceManaged
[info] /Users/code/my_project/target/scala-2.11/resource_managed

Is there a way to do this for tasks? That is to execute and view the result of a task in the console?

Upvotes: 2

Views: 1262

Answers (1)

gabrielgiussi
gabrielgiussi

Reputation: 9575

Yes, you can also print the results of a task in console with show. For example sbt 'show fullClasspath' or directly show fullClasspath in sbt interactive mode.

Remember that keys are scoped:

Examples of scoped key notation

  • fullClasspath specifies just a key, so the default scopes are used: current project, a key-dependent configuration, and global task scope.
  • test:fullClasspath specifies the configuration, so this is fullClasspath in the test configuration, with defaults for the other two scope axes.
  • *:fullClasspath specifies Global for the configuration, rather than the default configuration.
  • doc::fullClasspath specifies the fullClasspath key scoped to the doc task, with the defaults for the project and configuration axes.
  • {file:/home/hp/checkout/hello/}default-aea33a/test:fullClasspath specifies a project, {file:/home/hp/checkout/hello/}default-aea33a, where the project is identified with the build {file:/home/hp/checkout/hello/} and then a project id inside that build default-aea33a. Also specifies configuration test, but leaves the default task axis.
  • {file:/home/hp/checkout/hello/}/test:fullClasspath sets the project axis to “entire build” where the build is {file:/home/hp/checkout/hello/}.
  • {.}/test:fullClasspath sets the project axis to “entire build” where the build is {.}. {.} can be written ThisBuild in Scala code.
  • {file:/home/hp/checkout/hello/}/compile:doc::fullClasspath sets all three scope axes.

You can use inspect fullClasspath to see scopes for that task in your project in Related.

Upvotes: 4

Related Questions