Since JDK 1.2, package identification version in a JAR file can be included in 
the manifest in order to be able to answer to this question : "which version of 
the tools is this damn' JAR file I have here ?"
(see JDK's 
docs/guide/versioning/spec/VersioningSpecification.html#PackageVersionSpecification)

Here is my try to have this info in ant.jar :
First, I modified src/etc/Manifest :
----------------------
Manifest-Version: 1.0
Main-Class: org.apache.tools.ant.Main

Name: org/apache/tools/ant/
Specification-Title: Jakarta Ant
Specification-Version: 1.3
Specification-Vendor: Apache
Implementation-Title: org.apache.tools.ant
Implementation-Version: @VERSION@
Implementation-Vendor: Apache @[EMAIL PROTECTED]@TIME@
----------------------------

Then I modified build.xml's jar task
    <filter token="VERSION" value="${version}" />
    <filter token="DATE" value="${TODAY}" />
    <filter token="TIME" value="${TSTAMP}" />
    <copy  todir="${build.classes}"
             file="${manifest}"
             overwrite="true"
             filtering="on" />
    <jar jarfile="${build.lib}/${name}.jar"
         basedir="${build.classes}"
         manifest="${build.classes}/manifest">
      <exclude name="org/apache/tools/ant/taskdefs/optional/**" />
      <exclude name="manifest" />
    </jar>


I'm not sure the way I did that is good, but I really think this info should be 
included in every JAR file produced in every project.

Does anybody have a better idea for doing this ?
Is anybody interested in doing this ?


Herve BOUTEMY

Reply via email to