Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding vendor information to MANIFEST.MF using sbt-assembly

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)

like image 782
Josh Marcus Avatar asked Jan 25 '12 20:01

Josh Marcus


Video Answer


1 Answers

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"))))
like image 107
Jestan Nirojan Avatar answered Sep 28 '22 00:09

Jestan Nirojan