ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: About deleting jar files - i think it is a clear BUG
Date Mon, 04 Dec 2000 10:44:00 GMT
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

Mime
View raw message