No unnecessary warning message with the launch command

when using the proguarded coursier launcher
This commit is contained in:
Alexandre Archambault 2016-02-11 23:58:35 +01:00
parent 6e5bdd80a1
commit 1ef56e9f49
1 changed files with 17 additions and 11 deletions

View File

@ -13,6 +13,7 @@ import coursier.util.Parse
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.language.reflectiveCalls import scala.language.reflectiveCalls
import scala.util.Try
case class CommonOptions( case class CommonOptions(
@Help("Keep optional dependencies (Maven)") @Help("Keep optional dependencies (Maven)")
@ -228,7 +229,9 @@ case class Launch(
val contextLoader = Thread.currentThread().getContextClassLoader val contextLoader = Thread.currentThread().getContextClassLoader
val parentLoader0: ClassLoader = Launch.mainClassLoader(contextLoader) val parentLoader0: ClassLoader =
if (Try(contextLoader.loadClass("coursier.Launch")).isSuccess)
Launch.mainClassLoader(contextLoader)
.flatMap(cl => Option(cl.getParent)) .flatMap(cl => Option(cl.getParent))
.getOrElse { .getOrElse {
if (common.verbose0 >= 0) if (common.verbose0 >= 0)
@ -240,6 +243,9 @@ case class Launch(
) )
contextLoader contextLoader
} }
else
// proguarded -> no risk of conflicts, no need to find a specific ClassLoader
contextLoader
val (parentLoader, filteredFiles) = val (parentLoader, filteredFiles) =
if (isolated.isolated.isEmpty) if (isolated.isolated.isEmpty)