in kernel/src/main/scala/org/apache/toree/magic/builtin/AddDeps.scala [80:119]
override def execute(code: String): Unit = {
val nonOptionArgs = parseArgs(code)
dependencyDownloader.setPrintStream(printStream)
val repository = getAll(_repository).getOrElse(Nil)
val credentials = getAll(_credentials).getOrElse(Nil)
val excludes = getAll(_exclude).getOrElse(Nil)
val excludesSet = excludes.map((x: String) => {
if (x.contains(":")) {
(x.split(":")(0), x.split(":")(1))
} else {
(x, "*")
}
}: (String, String)).toSet
val repositoriesWithCreds = dependencyDownloader.resolveRepositoriesAndCredentials(repository, credentials)
if (nonOptionArgs.size == 3) {
// get the jars and hold onto the paths at which they reside
val uris = dependencyDownloader.retrieve(
groupId = nonOptionArgs.head,
artifactId = nonOptionArgs(1),
version = nonOptionArgs(2),
transitive = _transitive,
ignoreResolutionErrors = !_abortOnResolutionErrors,
extraRepositories = repositoriesWithCreds,
verbose = _verbose,
trace = _trace,
excludes = excludesSet,
configuration = get(_configuration),
artifactClassifier = get(_classifier)
)
// pass the new Jars to the kernel
kernel.addJars(uris.filter(_.getPath.endsWith(".jar")): _*)
} else {
printHelp(printStream, """%AddDeps my.company artifact-id version""")
}
}