Bug 63243

Summary: zipgroupfileset task causes the jar task to rebuilt its target needlessly
Product: Ant Reporter: mperdikeas
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: major CC: mperdikeas
Priority: P2    
Version: 1.9.9   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: short self-contained correct example showcasing the problem

Description mperdikeas 2019-03-07 16:56:23 UTC
Created attachment 36477 [details]
short self-contained correct example showcasing the problem

Note: I have created a github repo with a SSCCE here:

https://github.com/mperdikeas/jar-zipgroupfileset-problem-SSCCE

I have managed to reproduce this problem in a very minimal setting involving a very short build.xml file and just three test jar files. The crux of the matter is that I am trying to create an archive containing all class files found in a number of jars. For that, as advised in numerous posts on the web, I am using the Jar task with an embedded zipgroupfileset task in the following arrangement:

        <jar destfile="out.jar">
            <zipgroupfileset dir="some-jars">
                <include name="a.jar" />
                <include name="b.jar" />
            </zipgroupfileset>                        
        </jar>

The above works perfectly well. The target file (out.jar) is built only once (the very first time). Subsequent invocations of the target do not cause the out.jar file to be rebuilt unless one of the Jar files under the "some-jars" directory have, in the meantime, been updated. However, if I add just one additional jar file as in:

      <jar destfile="out.jar">
            <zipgroupfileset dir="some-jars">
                <include name="a.jar" />
                <include name="b.jar" />
                <include name="c.jar" />
            </zipgroupfileset>            
        </jar>

Then the output file (out.jar) is created on every single run! I've checked the dates of the files inside c.jar (in case one of them was some weird time in the future) but there's nothing untoward. The issue is not with the particular test jar files used, I've encountered it with different jar files as well.

I include as an attachment the entire SSCCE (that you can also find in the github project) sans the .git directory.

System Information
------------------
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

$ ant -version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Apache Ant(TM) version 1.9.9 compiled on April 21 2017