I have a project that uses SBT as a build system and integrates Scala / Java and native sources with JNI.
To remain as flexible as possible, my current plan for publishing such a project is to publish two different jars: one containing a clean bytecode (linking the native binary to the end user) and one thick jar that also contains its own libraries and extracts them automatically.
To create a fat jar, I created a task called packageFat , which essentially copies the packageBin task with additional mappings into its own libraries and the -fat suffix added to the name.
The corresponding part of the assembly configuration can be viewed here: https://github.com/jodersky/flow/blob/master/project/nativefat.scala
However, with this configuration, any project that depends on mine and wants to include a fat jar should declare a dependency in this form:
libraryDependencies += "<organization>" %% "<name>" % "<version>" artifacts Artifact("<name>-fat", "jar", "jar")
I know that distributing projects using JNI is pretty awkward, but the part after the last “%” makes the dependency really cumbersome. So my question is: what is the idiomatic way in SBT to publish one regular jar and one live jar from one project?
scala jni sbt
Jakob dersky
source share