I have a jar file which has two class files per java file.
Java:
Foo.java
Bar.java
Classfile:
Foo.class
Foo.class
Bar.c
Are you using the Ant Jar task? If so then you can most definitely get duplicate files in the same jar file. The duplicate attribute is used to stop that.
Please note that the zip format allows multiple files of the same fully-qualified name to exist within a single archive. This has been documented as causing various problems for unsuspecting users. If you wish to avoid this behavior you must set the duplicate attribute to a value other than its default, "add".
From the Ant Manual Page: http://ant.apache.org/manual/Tasks/jar.html
I think I found the problem. This is the jar task:
<jar basedir="${build.class.dir}" jarfile="${dist.dir}/${subproject}.jar">
<fileset dir="${build.class.dir}" />
</jar>
As I read in the Ant website
This task forms an implicit FileSet and supports most attributes of (dir becomes >basedir) as well as the nested , and elements.
So it would seem that either the tag or basedir is uneccessary. At least it works.fine if I comment out the fileset tag.
Thanks for your help and pointers!