Adding vendor information to MANIFEST.MF using sbt-assembly
Asked Answered
K

2

9

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

to

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

Everything works fine.

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

(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)

Katheykathi answered 25/1, 2012 at 20:58 Comment(0)
Z
13

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.

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

but this can be configured in your build.sbt or Build.scala

for example

    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"))))
Zabaglione answered 27/1, 2012 at 19:19 Comment(0)
T
0

The problem is that sbt assembly does not add the default keys to MANIFEST.MF. sbt package on the other hand does so, which his probably what Jestan Nirojan used.

I have created an issue for the sbt assembly plugin project on github. You might want to add a comment to increase the chance of it being fixed.

See this

Tick answered 29/4, 2013 at 15:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.