1

I am building an Eclipse plugin which I want to deliver with signed jars.

After using Eclipse UI for creating the update site and building the plugins and features from there manually I want to sign the created jars.

Doing so leads to the manifests in the jars losing their OSGI metainformation attributes and thus in plugins not being found after restarting eclipse. Only signing information is left in the Jars' manifests.

I use this snippet to sign the artifacts, but I can reproduce this behaviour also with the JDK tool jarsign:

<signjar alias="${keystore.alias}" keystore="${keystore}"
          storepass="${keystore.password}"
          lazy="true" tsaurl="http://time.certum.pl/">
    <path>
        <path refid="plugins"/>
        <path refid="features"/>
    </path>
</signjar>

From the plugins I use the provided Manifests from the plugins like this one:

Bundle-ManifestVersion: 2
Bundle-Name: Tomcat Manager Plugin

How can I achieve that an existing Manifest is preserved while signing?

Markus
  • 2,071
  • 4
  • 22
  • 44
  • You can use eclipse.jarsigner ant task. We use it un our proects and it works as yolu like. i have no information about jarsigner task. Maybe it also has an attribute line keepmanifest or useexistingmanifes... – guleryuz Apr 16 '16 at 08:50
  • I am not sure what you mean with the eclipse.jarsigner ant task. I am using the default ant task for jarsigning provided by ant itself: https://ant.apache.org/manual/Tasks/signjar.html – Markus Apr 18 '16 at 09:50
  • sorry, task name is eclipse.jarProcessor, it has an attribute for jar signing. sign="true" will sign the jar while kepping the existing manifest – guleryuz Apr 19 '16 at 08:08

1 Answers1

1

I figured out that the plugin Manifest is not a "real" Manifest from a JDK perspective. A Manifest from JDK perspective needs to have the Attribute Manifest-Version in it. So the Manifest from the question should look like this:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tomcat Manager Plugin

If the Manifest look like this and now has the obviously mandatory attribute Manifest-Version, the jarsigner does its job like expected and preserves existing Manifest content.

Markus
  • 2,071
  • 4
  • 22
  • 44