Thanks for you answers! I am sorry that I did not answer your letters earlier, I was out of the office.
Regarding compilation issue, it looks like Ant javac task does not handle "includes" and "excludes" attributes correctly when it is used with JDK 6.
But it works properly with JDK 5.
Please try attached issue demo.
In build.xml we are trying to compile A.java, using b.jar (with B.class) in classpath.
<javac srcdir="." destdir="." includes="A.java" excludes="B.java">
We explicitly exclude B.java from compilation.
JDK 5 in this case creates A.class and build finished succesfully.
JDK 6 creates A.class, and then *unexpectedly* tries to compile B.java (though B.java is excluded from compilation in javac task).
In my case it is the root of compilation problem.
Thanks for helping me!
Sergey Bondarenko wrote:As Stefan said, this is likely not related to Ant as such.
Imagine situation when you have 3 classes with dependencies between them:
A -> B -> C
Then you compile C.java and pack into c.jar
Then you compile B.java, using c.jar in classpath, and pack it into b.jar
Then you compile A.java, using b.jar.
It works properly in Java 5, but fails in Java 6: compiler can not resolve
dependency B->C (though you compile only A class).
As far as I am aware, the JLS does not specify under which conditions a Java compiler might require transitive dependencies to be present on the classpath, beyond the obvious fact that if the content of such a dependency could possibly affect the generated bytecode then it must be present. I seem to recall that Jikes used to behave differently than javac, and I am not that surprised if JDK 5 javac behaves differently from JDK 6 javac. To be on the safe side, you should include c.jar in the classpath when compiling A.java.