如何在MANIFEST.MF中将Class-Path设置为自定义类路径?

时间:2015-04-17 10:09:08

标签: sbt

我必须在其MANIFEST.MF中部署一个具有非常特定类路径的JAR。我如何配置sbt,以便打包的JAR具有此特定的类路径(例如):

.
lib/abc.jar
lib/xyz.jar
../../lib/maven/com/fasterxml/jackson/core/jackson-annotations/2.2.3/jackson-annotations-2.2.3.jar
../../lib/maven/com/fasterxml/jackson/core/jackson-core/2.2.3/jackson-core-2.2.3.jar
../../lib/maven/com/fasterxml/jackson/core/jackson-databind/2.2.3/jackson-databind-2.2.3.jar
../../lib/maven/commons-codec/commons-codec/1.9/commons-codec-1.9.jar
../../lib/maven/commons-io/commons-io/2.4/commons-io-2.4.jar
../../lib/maven/joda-time/joda-time/2.5/joda-time-2.5.jar
../../lib/maven/log4j/log4j/1.2.11/log4j-1.2.11.jar
../../lib/database/SQLServer2008/3.0.1301.101/sqljdbc4.jar

(当然,真正的还包括Scala。)

1 个答案:

答案 0 :(得分:4)

尝试在构建中添加类似的内容:

val classPath = Seq(
  ".",
  "lib/abc.jar",
  "lib/xyz.jar",
  "../../lib/maven/com/fasterxml/jackson/core/jackson-annotations/2.2.3/jackson-annotations-2.2.3.jar",
  "../../lib/maven/com/fasterxml/jackson/core/jackson-core/2.2.3/jackson-core-2.2.3.jar",
  "../../lib/maven/com/fasterxml/jackson/core/jackson-databind/2.2.3/jackson-databind-2.2.3.jar",
  "../../lib/maven/commons-codec/commons-codec/1.9/commons-codec-1.9.jar",
  "../../lib/maven/commons-io/commons-io/2.4/commons-io-2.4.jar",
  "../../lib/maven/joda-time/joda-time/2.5/joda-time-2.5.jar",
  "../../lib/maven/log4j/log4j/1.2.11/log4j-1.2.11.jar",
  "../../lib/database/SQLServer2008/3.0.1301.101/sqljdbc4.jar"
)

packageOptions += Package.ManifestAttributes(
  "Class-Path" -> classPath.mkString(" ")
)