使用ant将清单属性添加到现有jar文件

Jud*_*udd 8 java ant

自从最新的java版本(7u45)以来,我的webstart应用程序使用的第三方jar库中出现了大量错误,原因是缺少新的必需清单属性:

Missing Application-Name: manifest attribute for: http://site/lib/jh.jar
Missing Permissions manifest attribute for: http://site/lib/jh.jar
Missing Codebase manifest attribute for: http://lib/jh.jar
Run Code Online (Sandbox Code Playgroud)

因此,我需要运行批处理ant任务来更新30个左右所需库中的清单文件,然后才能使用它们进行分发.

我怎么能在蚂蚁中做到这一点?(最好没有ant-contrib)

PS:我已经修复了所有其他7u45更新废话(代码签名,JNLP attribs等).

小智 12

尝试这样的事情.

   <for param="jarFile">
        <fileset dir="${webapp.dir}">
            <include name="*.jar"/>
        </fileset>
        <sequential>
            <jar update="true" file="@{jarFile}">
                <manifest>
                    <attribute name="Application-Name" value="ABCDEF"/>
                    <attribute name="Codebase" value="*"/>
                    <attribute name="Permissions" value="all-permissions"/>
                </manifest>
            </jar>
        </sequential>
    </for>
Run Code Online (Sandbox Code Playgroud)