Bug 29085 - Timestamps in jar-Manifest
Summary: Timestamps in jar-Manifest
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.1
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
: 31410 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-19 12:22 UTC by daniel.estermann
Modified: 2009-07-31 05:42 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description daniel.estermann 2004-05-19 12:22:46 UTC
Currently, a jar-file is updated if one of the manifest entries changes.
If an entry contains the build-time, I don't want the jar to be rewritten every
time i build the project. The build-time entry should just be updated if
anything else in the jar changed.

I propose to introduce a new flag (named 'forceupdate' or similar) for a
manifest attribute. That flag tells wether the entry must be compared with the
old state or if a possible change should be ignored. 

<manifest>
  <attribute
    name="Build-Stamp"
    value="${DSTAMP}${TSTAMP}"
    forceupdate="false"/>
</manifest>

Implementation: 
A logical and simple solution is to change the Manifest.equals method to ignore
the selected entries. However, i do not know if this affects other tasks.
Comment 1 Jesse Glick 2004-06-05 19:50:16 UTC
This would be useful. netbeans.org has a generic script that uses something like

<tstamp>
  <format property="buildnumber" .../>
</tstamp>
<jar jarfile="..." manifest="${some-basic-manifest}">
  <manifest>
  <!-- various important fixed attributes... then: -->
    <attribute name="Impl-Version" value="${buildnumber}"/>
  </manifest>
  <fileset .../>
</jar>

Currently the JAR is always rebuilt, which is annoying and slows down the build.
Possible workaround would be to create a temporary manifest somewhere using
<manifest> with everything but the Impl-Version set to "@BUILD-NUMBER@", then
<copy> with a filter, then make the JAR; cumbersome.

I could probably supply a patch for this if committers would be interested in
applying it.
Comment 2 Stefan Bodewig 2009-07-31 05:42:30 UTC
*** Bug 31410 has been marked as a duplicate of this bug. ***