Last active
February 28, 2020 14:11
-
-
Save prakharjain09/7b49cfb1c797022f20c7b1266b2ce82b to your computer and use it in GitHub Desktop.
Get all jars in classpath (Scala)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def list_urls(cl: ClassLoader): Array[java.net.URL] = cl match { | |
| case null => Array() | |
| case u: java.net.URLClassLoader => u.getURLs() ++ list_urls(cl.getParent) | |
| case _ => list_urls(cl.getParent) | |
| } | |
| val urls = list_urls(getClass.getClassLoader).distinct | |
| println(urls.filterNot(_.toString.contains("ivy")).mkString("\n")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment