Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 55592 invoked from network); 28 Apr 2008 09:51:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Apr 2008 09:51:42 -0000 Received: (qmail 93926 invoked by uid 500); 28 Apr 2008 09:51:40 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 93893 invoked by uid 500); 28 Apr 2008 09:51:40 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 93882 invoked by uid 99); 28 Apr 2008 09:51:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Apr 2008 02:51:40 -0700 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [192.6.10.2] (HELO colossus.hpl.hp.com) (192.6.10.2) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Apr 2008 09:50:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by colossus.hpl.hp.com (Postfix) with ESMTP id 690556BA02 for ; Mon, 28 Apr 2008 10:50:53 +0100 (BST) X-Virus-Scanned: amavisd-new at hplb.hpl.hp.com Received: from colossus.hpl.hp.com ([127.0.0.1]) by localhost (colossus.hpl.hp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NASxqOLt3G1X for ; Mon, 28 Apr 2008 10:50:52 +0100 (BST) Received: from ha-node-br2.hpl.hp.com (ha-node-br2.hpl.hp.com [16.25.144.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by colossus.hpl.hp.com (Postfix) with ESMTP id C76F96B9E7 for ; Mon, 28 Apr 2008 10:50:51 +0100 (BST) MailScanner-NULL-Check: 1209981030.34505@/XWhRvuG/4qHc7yQaCaOLw Received: from [16.25.171.118] (morzine.hpl.hp.com [16.25.171.118]) by ha-node-br2.hpl.hp.com (8.14.1/8.13.4) with ESMTP id m3S9oTjh013859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 28 Apr 2008 10:50:30 +0100 (BST) Message-ID: <48159DE7.3050105@apache.org> Date: Mon, 28 Apr 2008 10:50:31 +0100 From: Steve Loughran User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Ant Users List Subject: Re: rebuilds even if source not changed References: <20080427133312.GA430@lefuneste.homelinux.org> In-Reply-To: <20080427133312.GA430@lefuneste.homelinux.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-HPL-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: m3S9oTjh013859 X-HPL-MailScanner: Found to be clean X-HPL-MailScanner-From: stevel@apache.org X-Virus-Checked: Checked by ClamAV on apache.org Jean-Rene David wrote: > Hello, > > When a class is in a package, the target > always rebuilds it even if the source hasn't > changed. Here's a test case: > > $ ant -version > Apache Ant version 1.7.0 compiled on December 13 2006 > > $ ls > build.xml > Welcome.java > > $ cat Welcome.java > package My.Class; > public class Welcome > { > public static void main(String[] args) > { > System.out.println("Hello World!"); > } > } > > $ cat build.xml > > > > > > > > > $ ant > Buildfile: build.xml > > build: > [mkdir] Created dir: /tmp/testcase/foo > [javac] Compiling 1 source file to /tmp/testcase/foo > > BUILD SUCCESSFUL > Total time: 1 second > > Now I just run it again: > > $ ant > Buildfile: build.xml > > build: > [javac] Compiling 1 source file to /tmp/testcase/foo > > BUILD SUCCESSFUL > Total time: 0 seconds > > And it recompiles but the source file hasn't > changed. > > My class is part of the My.Class package, so javac > put it in: foo/My/Class: > > $ find > . > ./Welcome.java > ./build.xml > ./foo > ./foo/My > ./foo/My/Class > ./foo/My/Class/Welcome.class > > But the task doesn't recurse the hierarchy > to find the class file. It only looks in the > "destdir" itself. So if I just: > > $ touch foo/Welcome.class you must move the class under the package name it is in. Without that not only does ant not do any dependency checking (is it expected to remember where every .class file comes from?) and sun's javac compiler wont build files in the correct order. -- Steve Loughran http://www.1060.org/blogxter/publish/5 Author: Ant in Action http://antbook.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org