Skip to content

Instantly share code, notes, and snippets.

@netologist
Created October 2, 2013 08:05
Show Gist options
  • Save netologist/6790457 to your computer and use it in GitHub Desktop.
Save netologist/6790457 to your computer and use it in GitHub Desktop.
sbt package dependency
packageOptions in (Compile, packageBin) <+= (target, externalDependencyClasspath in Runtime) map
{ (targetDirectory: File, classpath: Classpath) =>
val relativePaths = classpath map { attrFile: Attributed[File] => targetDirectory.toPath().relativize(attrFile.data.toPath()).toString() };
Package.ManifestAttributes(java.util.jar.Attributes.Name.CLASS_PATH -> relativePaths.reduceOption(_ + " " + _).getOrElse(""))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment