此时执行的结果
> show obfuscate
Hi!
[info] Hi! value
> show greeting
[info] Hello
如果修改HelloPlugin.scala中的一句为:
from:
greeting := "Hi!",
to:
greeting in obfuscate := "Hi!",
则执行结果变为
> show greeting
[info] Hello
> show obfuscate
Hello
[info] Hello value
符合预期,但是此时如果去掉build.sbt中的greeting := "Hello"
,则报错:
[error] References to undefined settings:
[error]
[error] compile:greeting from compile:obfuscate ((sbthello.HelloPlugin) HelloPlugin.scala:40)
[error] Did you mean compile:obfuscate::greeting ?
[error]
[error] compile:greeting from compile:obfuscate ((sbthello.HelloPlugin) HelloPlugin.scala:40)
[error] Did you mean compile:obfuscate::greeting ?
[error]
找到答案了,果然很naive:
http://stackoverflow.com/questions/34784300/how-to-read-the-modified-setting-defined-in-my-own-sbt-plugin