Search code examples
scalasbt-native-packager

Externalizing dependencies for sbt packages


My deployable bin for scala projects currently hits about 50MB, and almost 40MB of that is jar's that are not likely to change between deployments (scala-lang and aws). Is there a way to externalize them from the packaging, so that every build doesn't have to include them?


Solution

  • You can write your own deploy task. Use this code (https://stackoverflow.com/a/9519397/1809978) to customize deploy folder and choose the only jars you need (by marking them using attribute like "org.package" % "artifact" % "1.0" % "external"). And repeat same for internal folder.

    P.S. About referenced code: it's better to use sbt.IO for working with files.