There are a few old answered questions out there about this with answers that don't work for me in sbt 0.13.
What is the easiest way to copy all of a project's runtime dependencies (jars mostly) to some given directory in sbt 0.13? Please include where any given code should be placed.
If it matters this is for exporting some classes written in Scala (a servlet filter) for use in a war (in front of a legacy java servlet).
By default, sbt will just compile a jar of the contents of
src/main/resources
,src/main/scala
, andsrc/main/java
.To get all the jars in one place, you can use sbt-pack or sbt-native-packager. I'll show sbt-pack here because it's very simple.
Include the following in
project/plugins.sbt
:Then include the following in
build.sbt
:Then in sbt, run
pack
, and the jars will be copied totarget/pack/lib
. (This task also generates a start script intarget/pack/bin/
).