How to print/log val in sbt build?

To print a variable defined in build.sbt in the sbt shell, use sbt show.

From sbt shell

> show {{ variable name }}

From bash or zsh

sbt 'show {{ variable name }}'

Example

sbt 'show scalaVersion'

[info] Loading project definition from [...]/project
[info] Set current project to [...] (in build file:[...])
[info] 2.12.4

Source

sbt Reference Manual


If you want to print something when you type a string in sbt console,you can add

lazy val configTest = settingKey[String]("example")

configTest := "config test"

Then you will get

> configTest
[info] config test

Tags:

Sbt