Start scala replica loop from code using sbt

I am trying to start a scala replica loop (using breakif), and I am building / running from SBT, and I tried to follow the recommendations in the FAQ, but could not get it working.

Can someone give an example of MyType, which is used to configure parameters, as described, "MyType is a representative class that must be included in the path of the interpreter class and in its application class loader"

https://github.com/harrah/xsbt/wiki/FAQ (under "How do I use the scala interpreter in my code?")

Using scala 2.9.1 and sbt 0.11

thanks

+4
source share
1 answer

Links to frequently asked questions in a background discussion that shows how MyType is actually used,

Using:

 val settings = new Settings() settings.embeddedDefaults[MyType] 

Inside SBT:

 def embeddedDefaults[T: Manifest] { val loader = implicitly[Manifest[T]].erasure.getClassLoader explicitParentLoader = Some(loader) // for the Interpreter parentClassLoader getClasspath("app", loader) foreach { classpath.value = _ } getClasspath("boot", loader) foreach { bootclasspath.value = settings.bootclasspath.value + File.separator + _ } } 

So, MyType is only used to help SBT find the appropriate class loader. Presumably, you can select MyType as an arbitrary class from your project that you want to receive from the interpreter. This is basically what Frequently Asked Questions means when he says: “MyType” is a representative class that must be included in the interpreter class path and in its application class loader.

+1
source

Source: https://habr.com/ru/post/908715/


All Articles