使用 sbt-assembly 将供应商信息添加到 MANIFEST.MF [英] Adding vendor information to MANIFEST.MF using sbt-assembly

查看:52
本文介绍了使用 sbt-assembly 将供应商信息添加到 MANIFEST.MF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 sbt-assembly 创建一个可运行的 jar,但是我的应用程序崩溃了,因为 jai imageio 从 MANIFEST.MF 文件中加载了供应商名称.如果我从以下位置手动编辑 META-INF/MANIFEST.MF 文件:

I'm using sbt-assembly to create a runnable jar, but my application crashes because jai imageio loads the vendor name from the MANIFEST.MF file. If I manually edit the META-INF/MANIFEST.MF file from:

Manifest-Version: 1.0
Main-Class: myMainClass

Implementation-Vendor: foo
Implementation-Title: bar
Implementation-Version: 1.0
Manifest-Version: 1.0
Main-Class: myMainClass

一切正常.

如何配置 sbt 或 sbt-assembly 以在 jar 中包含额外的实现信息?或者有其他方法可以解决这个问题吗?

How do I configure sbt or sbt-assembly to include that additional implementation information in the jar? Or is there another way around this?

(ps:它查找包信息的位置的参考: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)

(p.s: The reference to where it looks up the package information: 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 中而无需任何额外配置:),我不确定您为什么会遇到这个问题.

I am using sbt 0.11.2 and, sbt adds the manifest information to the jar without any additional configuration :), I am not sure why you have that problem.

这是我在本地构建的swryl jar的示例MANIFEST.MF

This is a sample MANIFEST.MF of squryl jar which I built locally

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 中配置

but this can be configured in your build.sbt or 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"))))

这篇关于使用 sbt-assembly 将供应商信息添加到 MANIFEST.MF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆