当使用sbt-native-packager时,sbt修改lib输出目录

时间:2015-05-13 17:07:20

标签: sbt sbt-native-packager

如何修改最终打包拉链的输出以移动" lib"目录内容上升一级。基本上我输出一个拉链,内容是这样的:

ZIP FILE CONTENT:
-- my-plugin-1.0.jar
-- /lib
    -- /lib/mydependency1.jar
    -- /lib/mydependency2.jar

 ZIP FILE CONTENT I WISH TO HAVE:
 -- my-plugin-1.0.jar
 -- mydependency1.jar
 -- mydependency2.jar

我想把所有东西都移到" lib"向上输出一级。

sbt版本0.13.0

这是我的build.sbt:

import NativePackagerHelper._

organization := "com.company.product"
name := "my-plugin"
version := "1.0"
enablePlugins(UniversalPlugin)
packageName in Universal:= "deployment"
publishArtifact in (Compile, packageDoc) := false
artifactName := {
    (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
        artifact.name + "-" + module.revision + "." + artifact.extension
}
javacOptions ++= Seq("-source", "1.8")
mappings in Universal <+= packageBin in Compile map { jar => jar -> (jar.getName()) }
topLevelDirectory := None

plugins.sbt

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0")

命令行:

sbt universal:packageBin

1 个答案:

答案 0 :(得分:3)

看起来您的要求是sbt-native-packager中的头等公民:

mappings in Universal ++= contentOf("src/main/resources/cache")