ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel L. Boxwell" <>
Subject javac task: referencing dependent classes
Date Tue, 17 Sep 2002 22:38:31 GMT
I have run into a problem using the javac task in both ANT 1.4.1 and 1.5 using both jdk1.3.1
 and jdk1.4. It seems as though the ANT javac task is unable to include files in the classpath
unless they are already compiled.

When running javac from the command line, it is possible to include directories in the classpath
that contain uncompiled source (.java) files. Let's say that the file I am trying to compile
with javac depends on one of these referenced .java files. javac.exe has no trouble compiling
the dependent files and then building the original target. 

The ANT javac task; however, is unable to reference files in this manner. The dependent files
MUST be compiled in advance. This becomes a problem when trying to deal with circular dependencies
within your build. I have included the simplest of examples in the attached zip file. See
how the .bat file that calls javac has no trouble - then delete the generated class files
and try the ant build. If you leave the generated files, then ant has no problem!!

This is a simple example, but my problem is much larger: I have a large development team -
each with their own jar file. In the end I want to build all of the jars at once using a separate
invocation of javac, but dependencies will make this difficult. It would be nice to include
all the various src directories in the classpath of each javac invocation so javac will just
hunt for the dependent files itself. 

If anybody has a better solution to my problem, I am willing to entertain it, but it seems
to me that the javac task should work the same way as javac does. 

Thanks in advance,


View raw message