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?
The sbt-assembly plugin is an SBT plugin for building a single independent fat JAR file with all dependencies included. This is inspired by the popular Maven assembly plugin, which is used to build fat JARs in Maven.
Solution. Create a directory layout to match what SBT expects, then run sbt compile to compile your project, sbt run to run your project, and sbt package to package your project as a JAR file. Unlike Java, in Scala, the file's package name doesn't have to match the directory name.
All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.
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")
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With