【问题标题】:Adding vendor information to MANIFEST.MF using sbt-assembly使用 sbt-assembly 将供应商信息添加到 MANIFEST.MF
【发布时间】:2012-02-19 01:53:58
【问题描述】:

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

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 中包含额外的实现信息?还是有其他方法可以解决这个问题?

(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

【问题讨论】:

    标签: scala sbt sbt-assembly


    【解决方案1】:

    我使用的是 sbt 0.11.2,并且,sbt 将清单信息添加到 jar 中而无需任何额外配置 :),我不知道你为什么会遇到这个问题。

    这是我在本地构建的 scuryl 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"))))
    

    【讨论】:

      【解决方案2】:

      问题是 sbt 程序集没有将默认键添加到 MANIFEST.MF。另一方面,sbt 包是这样做的,这可能是 Jestan Nirojan 使用的。

      我在 github 上为 sbt 程序集插件项目创建了一个问题。您可能需要添加评论以增加修复的机会。

      See this

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-08-08
        • 1970-01-01
        • 1970-01-01
        • 2016-10-06
        • 1970-01-01
        • 2023-03-04
        • 2012-01-18
        相关资源
        最近更新 更多