How can you add additional parameters to a jar's manifest file when signing it? I have a javaws app that uses some external libraries. Starting with java7u25 there is a need for additional parameters in the manifest (permissions and codebase). How can I set these at signing (with maven if possible). I can set it at build time for the artifacts I produce but for the ones I get from the external repositories how can I insert them at signing time?

有帮助吗?

解决方案

I update the 3rd party jars prior to signing them. The ant task for updating the jar is:

jar ufm thirdparty.jar manifest_adder.mf

  • u: update

  • f: output to file

  • m: manifest file attached.

The manifest_adder.mf file will be merged with the existing manifest in the 3rd party jar.

其他提示

Important observation:

Note: The contents of the manifest must be encoded in UTF8.

I lost a lot of time because of that. Hope this help someone.

Don't know about maven, but i recently researched on this topic regarding appending the same attributes(those you mentioned) to third party jars at build time using ANT. The procedure in Java is creating another Manifest file(containing the new attributes) and appending it with the Manifest of the jar.You can check the command here. I was creating my jars at build time so i had two options:

First: 1) Unzip the jar 2) Modify Manifest 3) Create the Jar again

but this was quite cumbersome so i used exec() task of ANT to run the command for merging the two manifest.

Hope this resolves your problem. Thanks

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top