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)

Eugene Yokota
  • 94,654
  • 45
  • 215
  • 319
Josh Marcus
  • 1,749
  • 18
  • 30

2 Answers2

12

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"))))
Jestan Nirojan
  • 2,456
  • 19
  • 23
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

dumbfingers
  • 7,001
  • 5
  • 54
  • 80
RĂ¼diger Klaehn
  • 12,445
  • 3
  • 41
  • 57