Reputation: 1506
I have an Eclipse plugin for which I create the OSGi bundle JARs with Ant. I would like to sign them with the Ant task, but that overwrites the MANIFEST.MF contents with the class signatures, making the OSGi bundles unusable. The JDK jarsigner tool has the same behavior. The Eclipse PDE seems to have that functionality, but as far as I know you can only use it from within Eclipse. I want to be able to run my Ant build from the command line. Does anybody know of a simple way to append the class signatures to MANIFEST.MF instead of overwriting it?
Upvotes: 3
Views: 1021
Reputation: 1506
This seems to be a JDK issue. With 1.5.0_16
, the jarsigner overwrites my existing MANIFEST.MF, but with 1.6.0_13
everything works fine.
Upvotes: 2
Reputation: 10385
I don't think the manifest is overwritten by default. Observe the following console script:
$ touch MyMainClass.class
$ echo 'Main-Class: MyMainClass' > MyManifest
$ jar cvmf MyManifest myjar.jar MyMainClass.class
added manifest
adding: MyMainClass.class(in = 0) (out= 0)(stored 0%)
$ unzip -c myjar.jar META-INF/MANIFEST.MF
Archive: myjar.jar
inflating: META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.6.0_17 (Apple Inc.)
Main-Class: MyMainClass
$ jarsigner myjar.jar mykeyid
Enter Passphrase for keystore:
$ unzip -c myjar.jar META-INF/MANIFEST.MF
Archive: myjar.jar
inflating: META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.6.0_17 (Apple Inc.)
Main-Class: MyMainClass
Name: MyMainClass.class
SHA1-Digest: 2jmj7l5rSw0yVb/vlWAYkK/YBwk=
Upvotes: 2