Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.project
.settings/
.classpath
bin/

Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ object ScalaTestLauncher {
try {
val cpFilePath = args(0)
val classpath = Source.fromFile(args(0)).getLines()
val loader = ClassLoader.getSystemClassLoader
val method= classOf[URLClassLoader].getDeclaredMethod("addURL", classOf[URL]); //$NON-NLS-1$
method.setAccessible(true);
classpath.foreach(cp => method.invoke(loader, new File(cp.toString).toURI.toURL))

val runnerClass = Class.forName("org.scalatest.tools.Runner")

val urls = classpath.map { cp => new File(cp.toString).toURI.toURL }.toArray
val loader = new URLClassLoader(urls, ClassLoader.getSystemClassLoader)

Thread.currentThread().setContextClassLoader(loader)
val runnerClass = loader.loadClass("org.scalatest.tools.Runner")
val mainMethod = runnerClass.getMethod("main", args.getClass()) //$NON-NLS-1$
mainMethod.setAccessible(true)
mainMethod.invoke(null, Source.fromFile(args(1)).getLines().toArray)
Expand Down