The right way to do this is to use one of the sbt plugins to create jars. I tested both single-jar and assembly and both have support for excluding libraries from your jar. You can add settings to individual projects so that only some of them create banks.
I personally use assembly, but as this post indicates, you will run into problems if you have overlapping file names.
Edit:
In the above example, you added the following imports at the top:
import sbtassembly.Plugin._ import AssemblyKeys._
You would modify the project this way:
lazy val daemon = Project( id = "Daemon", base = file("Daemon"), dependencies = Seq(protocol), settings = assemblySettings )
Also you need to add the following to project/plugins.sbt
(for sbt.11):
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.7.3") resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
If you decide to go with Assembly, you probably need to remove duplicate files. Here is an example build code to avoid duplicate log4j.properties files in a project named "projectName". This should be added as part of the settings sequence for the project. Please note that the second compilation is a basic implementation and is required.
excludedFiles in assembly := { (bases: Seq[File]) => bases.filterNot(_.getAbsolutePath.contains("projectName")) flatMap { base => //Exclude all log4j.properties from other peoples jars ((base * "*").get collect { case f if f.getName.toLowerCase == "log4j.properties" => f }) ++ //Exclude the license and manifest from the exploded jars ((base / "META-INF" * "*").get collect { case f if f.getName.toLowerCase == "license" => f case f if f.getName.toLowerCase == "manifest.mf" => f }) } }
source share