Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 38378 invoked from network); 27 Jul 2000 09:31:49 -0000 Received: from fep8.mail.ozemail.net (203.2.192.102) by locus.apache.org with SMTP; 27 Jul 2000 09:31:49 -0000 Received: from cognetnt (2Cust3.tnt4.syd2.da.uu.net [63.12.24.3]) by fep8.mail.ozemail.net (8.9.0/8.6.12) with SMTP id TAA23818 for ; Thu, 27 Jul 2000 19:31:44 +1000 (EST) From: "Conor MacNeill" To: Subject: RE: New user with cyclic dependencies Date: Thu, 27 Jul 2000 19:30:24 +1000 Message-ID: <001601bff7ad$4addb570$80dc1fcb@cognet.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 In-Reply-To: <3.0.5.32.20000727160130.00865ca0@latcs2.cs.latrobe.edu.au> Importance: Normal X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N > At 12:55 27/7/00 -0500, you wrote: > >I know that if I ask javac to compile some files, and I include > the source > >directory as part of the classpath then javac will automatically compile > >the imported classes as it encounters them. It seems that ant's > javac is > >not doing this. > > hmmm - that so. I never knew that. In that case it may be possible to use > this hack by specifying classpath attribute in javac that includes > alternate source directories. > Javac, the compiler, will try to resolve class dependencies. If a class file cannot be found, javac will look for a .java file in the same location in the sourcepath package space and compile it. > >I guess one solution is to include all classes with cyclic > dependencies as > >a single target? I am not sure how to specify multiple > directories for a > >single javac task. > > well you can't and that is a design choice. I have never had to specify > multiple source directories and am not sure it is needed thou if you could > describe a use case where it is needed it may be possible to alter javac > task. Ant makes a few assumptions about layout - namely that all source > comes from one directory and that they are all in their respective package > directories. So if you have the class in package com.biz.a then the src > directory layout should be Peter, there is no such design choice (at least, not anymore). Ant supports multiple source paths. It does not make any assumptions about source tree layouts. There are two ways to specify the source paths 1. Use a path in the src attribute As I have shown here you can use either : or ; for the path separators and either / or \ as the file separators. Ant will work out the path for your platform. 2. Use a nested element - this would be the preferred way All of this is included in the documentation for the javac task. Also note that ant will compile a file even if it is not in its proper package space location. It will place the resulting class file in the proper package space location in the destination build directory. I strongly recommend against this practice. It means ant will always recompile the file even if it is not out of date. Javac will also not be able to determine the source file if it is necessary to compile the file for a missing class. Conor