Judd
Judd

Reputation: 111

Adding manifest properties to existing jar files with ant

Since the latest java release (7u45), I'm getting tons of errors on third part jar libraries that my webstart application uses, due to newly required manifest attributes being missing:

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

So, I need to run a batch ant task to update the manifest files in each of the 30 or so required libraries before I can use them for distribution.

How can I do this in ant? (preferably without ant-contrib)

PS: I've already fixed all the other 7u45 update crap (code signing, JNLP attribs, etc).

Upvotes: 9

Views: 6669

Answers (1)

preetham
preetham

Reputation: 161

Try something like this.

   <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>

Upvotes: 13

Related Questions