From 76b31e4fcf50fe1ef824266b5d666d71467ba5bc Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Mon, 11 Jan 2010 20:21:55 -0500 Subject: [PATCH] Fix console-project --- src/main/scala/sbt/Run.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/scala/sbt/Run.scala b/src/main/scala/sbt/Run.scala index 770789969..4d8a68ad6 100644 --- a/src/main/scala/sbt/Run.scala +++ b/src/main/scala/sbt/Run.scala @@ -106,16 +106,17 @@ object Run { override def createInterpreter() { - def urlClassLoader(c: Class[_]) = c.getClassLoader.asInstanceOf[URLClassLoader] - val loader = urlClassLoader(project.getClass) - val urls = List(loader, urlClassLoader(classOf[xsbti.Launcher])).flatMap(_.getURLs) // TODO: this is fragile and should be done better - compilerSettings.classpath.value = urls.flatMap(ClasspathUtilities.asFile).map(_.getAbsolutePath).mkString(File.pathSeparator) + val projectLoader = project.getClass.getClassLoader + val launcherJar = FileUtilities.classLocationFile[xsbti.Launcher] + val app = project.info.app + val classpathFiles = app.mainClasspath ++ app.scalaProvider.jars ++ Array(launcherJar) + compilerSettings.classpath.value = classpathFiles.map(_.getAbsolutePath).mkString(File.pathSeparator) project.log.debug(" Compiler classpath: " + compilerSettings.classpath.value) in = InteractiveReader.createDefault() interpreter = new Interpreter(settings) { - override protected def parentClassLoader = loader + override protected def parentClassLoader = projectLoader override protected def newCompiler(settings: Settings, reporter: Reporter) = super.newCompiler(compilerSettings, reporter) } interpreter.setContextClassLoader()