sbt 在使用 sbt-native-packager 时修改 lib 输出目录
sbt modify the lib output directory when using sbt-native-packager
如何修改最终打包 zip 的输出以将 "lib" 目录内容上移一级。基本上我输出一个zip,内容是这样的:
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
看来您的要求是 sbt-native-packager
的第一个 class 公民:
mappings in Universal ++= contentOf("src/main/resources/cache")
如何修改最终打包 zip 的输出以将 "lib" 目录内容上移一级。基本上我输出一个zip,内容是这样的:
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
看来您的要求是 sbt-native-packager
的第一个 class 公民:
mappings in Universal ++= contentOf("src/main/resources/cache")