sbt-assembly: how to link dependencies jar with main jar?
Use sbt-pack plugin at https://github.com/xerial/sbt-pack . So far I've found it the cleanest way to pack the project and dependencies.
See Setting Classpath Still Can't Find External Jar. Oracle says:
When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.
So, you have to say:
java -cp "foo-assembly-0.1-deps.jar:foo-assembly-0.1.jar" Main
where Main
is the name of the main class, and :
is the file separator on your OS (;
on Windows) .
Currently there seems to be a bug in assembly-package-scala
and it comes out empty, but it shouldn't matter because assembly-package-dependency
contains Scala library too.