views:

116

answers:

4

So, I have an interesting question. I have three people using the same ant build xml file creating a jar file for an Eclipse project that hasn't changed in two months. We each do a build using this xml file and we each get a different sized jar (62 KB, 78 KB, and 101 KB). Also, when I do a winmerge on them, they are dramatically different.

What could cause this difference?

+6  A: 

First thing to try: copy them all onto the same computer, unpack them in different directories, and run WinDiff (or whatever) on the uncompressed version. That will make it much more obvious what's going on.

Other possibilities - different versions of Java using different compression levels by default?

Jon Skeet
I put them all on the same computer. After extracting them, I did see a very obvious difference of some metrics files that I failed to delete from my project. Other than that, the class file names and structures were the same. However, the class files were flagged as different for some reason. We're also all using Java 1.6.0.17 and the compression levels should all be the same. I think I found more questions than answers.
Dopyiii
+3  A: 

In addition to Jon's suggestion, are there user preferences that ant script may pickup?

E.g. build.properties file that can live in project directory, user home directory, etc.

It may be the case that there are different customizations of the project on each person's workstation.

Alexander Pogrebnyak
I don't know. I'll have to see if this file exists, and perhaps if any others are getting sucked in. Could you point me in the direction of any others to look for?
Dopyiii
@Dopyiii. Look for `<property file="..."/>` or `<xmlproperty file="..."/>` tasks in your build.xml and in any files imported by the top-level build.xml.
Alexander Pogrebnyak
+1  A: 

Sounds like the folders being jarred together are not empty when the process begins.

Thorbjørn Ravn Andersen
+1  A: 

The only difference I can see can be:

  1. Difference in environment variables resulting in difference in compilers. Does your ant script use any other utility in addition to the regular javac for compilation or packaging? Ex: does it use AspectJ or some other assembling utility? Is that dependent on environmental variables that are different for different machines?
  2. Difference in the size of dependent jars (one of you might have commons-logging-1.8 while the other may have a different version for example)
  3. Do you invoke any other build utility from ant that does dependency management such as ivy for instance?

You said winmerge shows dramatic differences. Are these w.r.t. the size of the various components inside the jar or are there structural differences (folder structures, different files etc.)? The latter would be more perplexing for sure.

raja kolluru
Excellent suggestions. 1: there may be different EV's, but we all use the same compiler and version. No other packaging utilities are used. 2: that's worth looking into. We use many FOSS/COTS products, so different versions may be picked up depending on build and inclusion order (that's a scary thought). 3: nothing like that.The differences shown in winmerge show that the bytecode is different. The length is different, and about 1/2 the content is different.
Dopyiii