ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Bondarenko" <>
Subject Re: javac task problem in Java 6
Date Tue, 04 Nov 2008 10:07:05 GMT
Hi guys!

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, using b.jar (with B.class) in

<project default="compile">
    <target name="compile">
        <javac srcdir="." destdir="." includes="" excludes="">
                <pathelement path="b.jar"/>

We explicitly exclude 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
(though is excluded from compilation in javac task).

In my case it is the root of compilation problem.

Thanks for helping me!

Sergey Bondarenko.

2008/11/4 Jesse Glick <>

> Sergey Bondarenko wrote:
>> Imagine situation when you have 3 classes with dependencies between them:
>> A -> B -> C
>> Then you compile and pack into c.jar
>> Then you compile, using c.jar in classpath, and pack it into b.jar
>> Then you compile, 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 Stefan said, this is likely not related to Ant as such.
> 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
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message