Created
March 19, 2014 22:20
-
-
Save quintona/9652666 to your computer and use it in GitHub Desktop.
Very nice little hack that Laurence put together to change the way one can package dependencies with assembly. This is potential useful for only hadoop based deployments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val IncludeInLib = Configurations.config("include-lib") | |
def addSpecifiedDependenciesToLibInAssembly = inConfig(IncludeInLib)(Defaults.configSettings) ++ Seq( | |
(libraryDependencies in IncludeInLib) := Nil, // needed otherwise scala library gets included. | |
(assembledMappings in assembly) <<= (libraryDependencies in IncludeInLib, externalDependencyClasspath in IncludeInLib, assembledMappings in assembly) map ((specified, managed, mappings) => { | |
{ | |
val filtered = managed.filter(af => specified.map(_.organization).exists(_ == af.get(moduleID.key).get.organization)) | |
val managedMappings = filtered.map(_.data).map(f => MappingSet(Some(f), Vector(f -> ("lib/" + f.getName)))) | |
for (mappingSet <- managedMappings; mapping <- mappingSet.mappings) { | |
val (file, path) = mapping | |
println("Adding managed (include in lib) dependency at " + path) | |
} | |
managedMappings ++ mappings | |
} | |
}) | |
) | |
addSpecifiedDependenciesToLibInAssembly | |
(libraryDependencies in IncludeInLib) := Seq("org.apache.hive" % "hive-builtins" % "0.10.0.jar" intransitive()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment