Tired of spinning up SBT just to wire in some dependencies for a quick REPL session? Me too! The following pair of scripts completely resolves this issue. Well, mostly…
list-jars
is not actually an Ivy2 resolver. What it does is enumerate all possible JARS within ~/.ivy2/cache
(in other words, it excludes locally published artifacts), filters them where relevant for only Scala 2.11 cross-builds, and then orders them (via a very primitive partial ordering) by version, always selecting the latest one. No attempt is made to do any real dependency resolution and JAR hell escaping! So…if something doesn't work, you're on your own.
The fun thing is that you can just launch scala-ivy
and use all your fancy third-party libraries without having to do any classpath setup.
- JAR hell is a real thing. Don't get sent there.
- If you have a truly staggering number of JARs in your Ivy cache, you will eventually overrun the maximum argument length. This number is probably somewhere between 500 and 1000 JARs. Note that running
list-jars | wc -l
will give you an idea of how likely this overrun is (on my system, this command returns 117 and things work fine).