Ant task to remove signature from jar file
April 1, 2014 Leave a comment
This article suggest an Ant macro that removes the publisher signature from an java .jar file, also known as to ‘unsign’ a jar.
<macrodef name="unsignjar"> <attribute name="jarFile" /> <sequential> <jar update="yes" jarfile="@{jarFile}.tmp"> <zipfileset src="@{jarFile}"> <include name="**"/> <exclude name="META-INF/*.SF"/> <exclude name="META-INF/*.DSA"/> <exclude name="META-INF/*.RSA"/> </zipfileset> </jar> <move file="@{jarFile}.tmp" tofile="@{jarFile}" overwrite="true" /> </sequential> </macrodef>
An example how to call the macro.
<target ...> ... <unsignjar jarFile="hibernate.jar" /> ... </target>