How can I add unmanaged JARs in sbt-assembly to the final fat JAR?
Asked Answered
K

3

19

My project has dependencies on a JAR file that isn't in Ivy, how can I include it directly in the final JAR output by sbt-assembly?

Kerrison answered 11/9, 2013 at 19:13 Comment(0)
K
32

Figured out I just have to add them explicitly as unmanaged dependencies in Build.scala, they are not automatically pulled in from the lib folder. Adding this line to settings worked:

unmanagedJars in Compile += file("lib/vertica_jdk_5.jar")

Kerrison answered 11/9, 2013 at 19:18 Comment(2)
did you have to add anything to Build.scala in the end? I am trying to package some source code with an unmanaged jar located in "lib" folder at the base directory... but when I compare the size of the resulting jar, it is smaller than the unmanaged jarHieratic
what/where is Build.scala in project ?Cence
F
16

For a single project setup, putting jars into lib should work. If you have multi-project setup the lib directory would be under each subproject like app/lib.

Fusty answered 12/9, 2013 at 20:9 Comment(2)
This bit of information saved a lot of time for me.Chaille
Absolutely works.Phosphocreatine
Z
1

Just an update for those searching unmanaged dependencies: Updated documentation for 0.13.2 is here: http://www.scala-sbt.org/release/docs/Getting-Started/Library-Dependencies.html

Zwolle answered 29/4, 2014 at 20:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.