mirror of https://github.com/sbt/sbt.git
No unnecessary warning message with the launch command
when using the proguarded coursier launcher
This commit is contained in:
parent
6e5bdd80a1
commit
1ef56e9f49
|
|
@ -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,18 +229,23 @@ case class Launch(
|
||||||
|
|
||||||
val contextLoader = Thread.currentThread().getContextClassLoader
|
val contextLoader = Thread.currentThread().getContextClassLoader
|
||||||
|
|
||||||
val parentLoader0: ClassLoader = Launch.mainClassLoader(contextLoader)
|
val parentLoader0: ClassLoader =
|
||||||
.flatMap(cl => Option(cl.getParent))
|
if (Try(contextLoader.loadClass("coursier.Launch")).isSuccess)
|
||||||
.getOrElse {
|
Launch.mainClassLoader(contextLoader)
|
||||||
if (common.verbose0 >= 0)
|
.flatMap(cl => Option(cl.getParent))
|
||||||
Console.err.println(
|
.getOrElse {
|
||||||
"Warning: cannot find the main ClassLoader that launched coursier. " +
|
if (common.verbose0 >= 0)
|
||||||
"Was coursier launched by its main launcher? " +
|
Console.err.println(
|
||||||
"The ClassLoader of the application that is about to be launched will be intertwined " +
|
"Warning: cannot find the main ClassLoader that launched coursier. " +
|
||||||
"with the one of coursier, which may be a problem if their dependencies conflict."
|
"Was coursier launched by its main launcher? " +
|
||||||
)
|
"The ClassLoader of the application that is about to be launched will be intertwined " +
|
||||||
|
"with the one of coursier, which may be a problem if their dependencies conflict."
|
||||||
|
)
|
||||||
|
contextLoader
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// proguarded -> no risk of conflicts, no need to find a specific ClassLoader
|
||||||
contextLoader
|
contextLoader
|
||||||
}
|
|
||||||
|
|
||||||
val (parentLoader, filteredFiles) =
|
val (parentLoader, filteredFiles) =
|
||||||
if (isolated.isolated.isEmpty)
|
if (isolated.isolated.isEmpty)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue