Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant claims Implementation-Title/Version/Vendor not set, but they are

Tags:

ant

I'm running ant 1.8.0 in verbose mode. I have created a manifest containing Implementation-Title, -Version and -Vendor and the resulting JAR contains a manifest with those in it. The JAR's class runs fine. However, output from ant says

[jar] No Implementation-Title set.No Implementation-Version set.No Implementation-Vendor set.

Is this just a bug in ant or am I missing something here?

Thanks

Here's my ant code:

<?xml version="1.0" encoding="UTF-8"?>
<project name="helloworld.makejar" default="makejar" basedir=".">
  <target name ="makejar" description="Create a JAR for the HelloWorld project">
    <delete file="helloworld.jar" />
    <delete file="MANIFEST.MF" />

    <manifest file="MANIFEST.MF">
      <attribute name="Built-By" value="${user.name}" />
      <attribute name="Main-Class" value="project.builder.example.HelloWorld" />
      <section name="common">
        <attribute name="Specification-Title"    value="Example" />
        <attribute name="Specification-Version"  value="1.0.0" />
        <attribute name="Specification-Vendor"   value="Example Organization" />
        <attribute name="Implementation-Title"   value="common" />
        <attribute name="Implementation-Version" value="1.0.0 today" />
        <attribute name="Implementation-Vendor"  value="Acme Corp." />
      </section>
    </manifest>

    <jar jarfile="helloworld.jar"
         includes="**/*.class"
         basedir="bin"
         manifest="MANIFEST.MF"
     />
  </target>
  <javac srcdir="src" destdir="bin" />
</project>
like image 572
Russ Bateman Avatar asked Aug 24 '11 21:08

Russ Bateman


1 Answers

I think the problem is that the attributes must be defined as children of the manifest element, as opposed to being children of the nested section.

Update

Maybe using an inline manifest element would make a difference. The following snippet is from the Ant docs:

<jar destfile="test.jar" basedir=".">
    <include name="build"/>
    <manifest>
        <!-- Who is building this jar? -->
        <attribute name="Built-By" value="${user.name}"/>
        <!-- Information about the program itself -->
        <attribute name="Implementation-Vendor" value="ACME inc."/>
        <attribute name="Implementation-Title" value="GreatProduct"/>
        <attribute name="Implementation-Version" value="1.0.0beta2"/>
        <!-- details -->
        <section name="common/MyClass.class">
            <attribute name="Sealed" value="false"/>
        </section>
    </manifest>
</jar>
like image 123
KevinS Avatar answered Sep 21 '22 05:09

KevinS