Compile at Runtime using Run to specified folder

Hello People, I am not finding any solution to my Problem in the Documentation. I am compiling scala code at runtime using a global.Run . However it is compiling to the root of my project. I want to specify the folder to which my .class files are compiled to.
`

// Define a Run. A Run is an execution of the scala compiler.
val global = new Global(settings)
val run = new global.Run

// Compile exported code and the simulator that uses it
Log.trace("Compiling", this.getClass.getName)
run.compile(List("src/main/resources/scala/Simulator.scala", this.path.resolve("scalaExec.scala").toString))`

Try

val settings = new Settings
settings.outputDirs.setSingleOutput(outputDirectory)
val global = new Global(settings)

Dynamic compilation of multiple Scala classes at runtime

Tensorflow in Scala reflection

How to eval code that uses InterfaceStability annotation (that fails with “illegal cyclic reference involving class InterfaceStability”)?

Hi, I have a related question in the Scala 3 environs, would be great to have some input on that.