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

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

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!

Regards,
Sergey Bondarenko.

2008/11/4 Jesse Glick <jesse.glick@sun.com>
Sergey Bondarenko wrote:
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 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 A.java.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org