I am coding in scala and using SBT with sbt-assembly plugin. My project has a lot of external libraries, and therefore sbt-assembly takes a long time to pack the JAR file. I would like to have a separate jar files for my code and for the dependencies. Therefore, I could simply recompile and repack only my code. How to do this?
Progress so far:
The following commands in the build.sbt
prevents sbt-assembly from packing the libraries:
assembleArtifact in packageScala := false
assembleArtifact in packageDependency := false
Then separate jars can be built by passing following commands: assembly
, assembly-package-scala
and assembly-package-dependency
. They make three jars: one containing my program, one with scala libraries and one with all the dependencies.
However, the jar file is not executable anymore because it does not see the dependencies in the separate jar file. I think I need to add a classpath to assembly-sbt, but I am not sure how to do this.