This is not the most efficient usage of the library, but is the one with the most expected behavior:
// sourceDir is the folder with the scala source files
val sse = ScalaScriptEngine.onChangeRefresh(sourceDir)
// get the class which should extend statically
// compiled trait ClzTrait
val clzTraitClass=sse.get[ClzTrait]("my.dynamic.Clz")
// or get a new instance
val clzTrait=sse.newInstance[ClzTrait]("my.dynamic.Clz")
The ScalaScriptEngine class works by keeping versions of compiled source directories. Version 1 can be loaded during initialization of the engine or during the request for the first script. After that, there are different policies to refresh the changed source files:
In case of compilation errors, the previous version remains in use.
Hey – does it work from sbt? i.e. inside a play app?
Sorry – I know how to embed it in an sbt project file.
The question was if it does work if my project is ran with SBT – there’s a hole can of worms hiding there, that’s why the question…
https://gist.github.com/404272
I was doing this again yesterday and forgot how to generate the app.class.path file, I though you may have done it recently.
From: Razvan Cojocaru [mailto:p...@razie.com]
Sent: October-18-12 10:22 AM
To: 'Konstantinos Kougios'; 'scala...@googlegroups.com'
Subject: RE: [scala-user] ScalaScriptEngine 1.2.0 with java sandbox
Sorry – I know how to embed it in an sbt project file.
The question was if it does work if my project is ran with SBT – there’s a hole can of worms hiding there, that’s why the question…