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 solved this by implementing a custom maven plugin that apart from getting the jars from the repository will also inject the required manifest entries. – Sorin Dabiste Apr 09 '14 at 16:03
3 Answers
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.

- 46
- 4
-
I selected yours as the answer even though I used a (technically) different approach (but the main idea is the same) since there is no way than doing it without this additional step (before/after signing). – Sorin Dabiste Apr 09 '14 at 16:05
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.

- 314
- 3
- 10
-
Valid ASCII is also valid UTF8, so typically this shouldn't be a problem; can you elaborate on what you had to do to make it work? – Harry Johnston Feb 04 '14 at 22:27
-
I've just opened the Manifest.mf with windows notepad and everything will be ok. – Saeger Feb 10 '14 at 19:24
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

- 157
- 1
- 11