Adding Attribute to JAR's Manifest Via ANT TASK

落爺英雄遲暮 提交于 2019-12-25 02:39:10

问题


all i am stuck with an issue. I have 14 third party jars.I am signing those jars with comodo code sign certificate successfully via ant task.

Now i want to accomplish that whenever i sign those jars i need to add some attributes to jar's manifest file ,

How can i do that ?

I found some manifest task inside jar task but did not find anything while signing.

all those jars are third party jars and already packed so i think do not need to compile and pack them from the source.

Thanks


回答1:


You'd probably have to do something like this for each jar file:

<unzip src="${jar.file.location}" dest="${manifest.dest.dir}">
    <patternset>
        <include name="**/MANIFEST.MF"/>
    </patternset>
</unzip>

<manifest file="${manifest.dest.dir}/MANIFEST.MF" mode="update">
    <attribute name="${myAttribute}" value="${myAttributeValue}"/>
</manifest>

<jar update="true" destfile="${jar.file.location}" basedir="${manifest.dest.dir}"/>


来源:https://stackoverflow.com/questions/20525356/adding-attribute-to-jars-manifest-via-ant-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!