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 85664 invoked from network); 4 Dec 2000 10:44:01 -0000 Received: from pscgate.progress.com (192.77.186.1) by locus.apache.org with SMTP; 4 Dec 2000 10:44:01 -0000 Received: from elvirus.progress.com (elvirus [192.77.186.100]) by pscgate.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id eB4Ai2O13978 for ; Mon, 4 Dec 2000 05:44:02 -0500 (EST) Received: from progress.COM (localhost [127.0.0.1]) by elvirus.progress.com (8.10.2/8.10.2/PSC-4.01) with ESMTP id eB4AjUo07988 for ; Mon, 4 Dec 2000 05:45:30 -0500 (EST) Received: from naserv.bedford.progress.com (naserv [172.16.5.174]) by progress.COM (8.7.2/PSC-1.0) with ESMTP id FAA28899 for ; Mon, 4 Dec 2000 05:44:01 -0500 (EST) Received: from progress.com ([172.16.107.175]) by naserv.bedford.progress.com (Netscape Messaging Server 4.15) with ESMTP id G51HTC00.7X9 for ; Mon, 4 Dec 2000 05:44:00 -0500 Message-ID: <3A2B7570.4D054479@progress.com> Date: Mon, 04 Dec 2000 05:44:00 -0500 From: "Bill Burton" Organization: Progress Software Corporation X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en-US,ja MIME-Version: 1.0 To: ant-user@jakarta.apache.org Subject: Re: About deleting jar files - i think it is a clear BUG References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Hello Edwin, Edwin.Guenthner@Compart.net wrote: > > Hello, > > I have seen that other people already encountered a problem: > it is not possible to delete jar files. There was some discussion about > this > topic last month but I think that I can add another point: > > I had the same problem: I specify a directory to delete / build > where I will later place the _result_ of my build process: a jar-file. > First run is fine, but as soon as the jar file exists, build fails. > > A closer look showed me the reason: > > when ant starts, it will setup the property > > java.class.path Not exactly. It's the JVM doing this. But the blame lies with the ant/.bat scripts and/or the documentation. The solution is to unset/reset your CLASSPATH before running ant so that it doesn't include any directories in the build tree or more specifically that will be altered as part of the build. In ant.bat is the following line: set LOCALCLASSPATH="%CLASSPATH%" and in the ant shell script the lines: if [ "$CLASSPATH" != "" ] ; then LOCALCLASSPATH=$CLASSPATH:$LOCALCLASSPATH fi The end result is the ant scripts always adds the contents of the existing CLASSPATH environment variable before ant's CLASSPATH. Since Ant is fairly self contained, for most purposes, the existing CLASSPATH shouldn't be required for builds and should be ignored. Many users may set up their environment with a CLASSPATH that does include what they need to run other tools and/or run the built application itself. By Ant assuming the existing CLASSPATH is appropriate lends itself to all kinds of problems like this. I suggest that the ant scripts be modified to ignore the existing CLASSPATH. Instead, they could look for a variable ANT_CLASSPATH and use that instead of CLASSPATH. Optionally, the ant scripts could also support a -cp option which would add the specified CLASSPATH before Ant's CLASSPATH and override any value of ANT_CLASSPATH. The only problem I can see with a -cp option is that on Windows OS's, directories with spaces in them would probably not work. -Bill Burton