You can get the desired result by manipulating mappings in (Compile, packageBin) to include the files you want your packaged jar to have ( publish uses the output from packageBin ). This method will allow you to include absolutely any file that you want in the bank. The sbt whitepaper is here: http://www.scala-sbt.org/0.12.3/docs/Howto/package.html#contents
As an example, consider the general case of including a .properties file in your jar. Suppose you need to include "messages.properties" in the path "com / bigco / messages.properties" in your packaged jar. And let's say that this file is under src / main / scala / ... You can add the following to your build.sbt file:
mappings in (Compile, packageBin) <+= baseDirectory map { base => (base / "src" / "main" / "scala" / "com" / "bigco" / "messages.properties") -> "com/bigco/messages.properties" }
To try and answer your original question, you can unzip foo.jar and add each of the class files inside the packed jar according to their correct package paths. So, something similar to
mappings in (Compile, packageBin) <+= baseDirectory map { base => (base / path / to / unzipped / file.class) -> "path.to.unzipped.file.class" ... }
Or you can just get away with foo.jar in the root of a packaged jar like this:
mappings in (Compile, packageBin) <+= baseDirectory map { base => (base / "lib" / "foo.jar") -> "foo.jar" }
source share