我正在使用 sbt- assembly 创建一个可运行的 jar,但我的应用程序崩溃了,因为 jai imageio 从 MANIFEST.MF 文件加载供应商名称。如果我手动编辑 META-INF/MANIFEST.MF 文件:
Manifest-Version: 1.0
Main-Class: myMainClass
to
Implementation-Vendor: foo
Implementation-Title: bar
Implementation-Version: 1.0
Manifest-Version: 1.0
Main-Class: myMainClass
一切正常。
如何配置 sbt 或 sbt-assemble 以在 jar 中包含附加的实现信息?或者还有其他方法可以解决这个问题吗?
(p.s:查找包信息的参考:http://www.java.net/external?url=http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules/Java-Advanced-Imaging/com/sun/media/ imageioimpl/common/PackageUtil.java.htm http://www.java.net/external?url=http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules/Java-Advanced-Imaging/com/sun/media/imageioimpl/common/PackageUtil.java.htm)
我正在使用 sbt 0.11.2,并且 sbt 将清单信息添加到 jar 中,无需任何其他配置:),我不确定你为什么会遇到这个问题。
这是我在本地构建的 sqryl jar 的示例 MANIFEST.MF
Manifest-Version: 1.0
Implementation-Vendor: org.squeryl
Implementation-Title: squeryl
Implementation-Version: 0.9.5-rc1
Implementation-Vendor-Id: org.squeryl
Specification-Vendor: org.squeryl
Specification-Title: squeryl
Specification-Version: 0.9.5-rc1
Main-Class: org.squeryl.logging.UsageProfileConsolidator
但这可以在 build.sbt 或 Build.scala 中配置
例如
import sbt._
import Keys._
import sbt.Package.ManifestAttributes
//......
//......
lazy val baseSettings = Defaults.defaultSettings ++ Seq(
version := ProjectVersion,
organization := Organization,
scalaVersion := ScalaVersion,
packageOptions := Seq(ManifestAttributes(
("Implementation-Vendor", "myCompany"),
("Implementation-Title", "myLib"))))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)