如何在sbt构建中打印/记录val?
问题描述:
如果我们想打印/登录一个简单的变量一样,如何在sbt构建中打印/记录val?
lazy val config = ConfigFactory.load()
而且在SBT检查它的价值,那么我们该怎么做呢?
当我刚刚在SBT shell中键入它,我得到:
> config
[error] Not a valid command: config
[error] Not a valid project ID: config
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: config (similar: configuration, deploy-configs, conflictManager)
[error] config
答
如果你想,当你键入SBT控制台的字符串打印的东西,你可以添加
lazy val configTest = settingKey[String]("example")
configTest := "config test"
然后你将得到
> configTest
[info] config test