How do I resolve import conflicts in scala?
I launched this shell from sbt with the "console-project" command.
scala> settings
<console>:24: error: reference to settings is ambiguous;
it is imported twice in the same scope by
import Keys._
and import settings
settings
^
How do I开发者_StackOverflow中文版 get the shell to display the settings object, not Keys.settings?
Assuming that you imported Keys._
and settings
yourself you can rename settings
from Keys
, like so:
import Keys.{settings => keySettings, _}
You can always resolve conflicts by using the full path to the object you want.
So if you want settings
defined in package/object repl
than you can refer to repl.settings
.
Or if you don't need the other settings, you can just ignore it by renaming it to :
import Keys.{settings => _, _}
You should add this libs to you class-path: (this is for play-framewrk 2.0 application, But I hope it could help)
/home/user/play/framework/sbt/boot/scala-2.9.1/org.scala-tools.sbt/sbt/0.11.0
there is a jar with name main_2.9.1-0.11.0.jar where you can find the Keys. In fact it is enough to export this jar only to your class-path.
精彩评论