I'd like to play around with reflection in scala (2.10.2) by following the example in this tutorial. things work fine when I start the sbt (version 0.13) and import scala.refelct.runtime.universe._
scala> import scala.reflect.runtime.universe._ │~
import scala.reflect.runtime.universe._
but when I try to put the sample code to an object like
object ReflectExample {
import scala.reflect.runtime.universe._
/*
the rest of the Example
*/
}
and compile the code by sbt compile I see the following error message like:
[error] object runtime is not a member of package reflect
[error] import scala.reflect.runtime.universe._
As explained in sbt's documentation, you need to add this line to the libraryDependencies
field of your project in build.sbt
:
"org.scala-lang" % "scala-reflect" % scalaVersion.value
You may want to try adding dependency to http://mvnrepository.com/artifact/org.scala-lang/scala-reflect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With