SBT Native Packager - How to retrieve libraryDependencies and store them as part of the package?

628 views Asked by At

I recently discovered the SBT Native Packager plugin which I thought would help solve all my packaging and deployment problems. On the face of it, it looks like it should however I have a problem which I would assume is a fairly basic ask; I want to be able to copy all managed dependencies from my project to the lib directory of my package for deployment.

I read through the docs carefully but there doesn't seem to be an obvious way to do this.

There are some instructions in there that explain how to copy the artefact from the project:

mappings in Universal <+= (packageBin in Compile) map { jar =>
  jar -> ("lib/" + jar.getName)
}

but I want to be able to do the same for the managed dependencies.

Did I miss something? I read through most of the sbt docs on managed dependencies and that didn't give me the answer either. I could of course use retrieveManaged := true to download into the lib_managed dir and grab from there but it feels like a bit of a hack.

Can anyone help?

James

1

There are 1 answers

1
ifrain On

I was looking around for resolving the same problem and finally found that putting the following in my 'build.sbt' file did the trick even if your application is in scala:

packageArchetype.java_application

exportJars := true