ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject self modifying jar?
Date Fri, 30 Jun 2000 16:23:00 GMT
I think I have discovered a slight issue with build.bat (and presumably build.bat starts ant using the jar in lib/ant.jar. During the
build process, however, it is possible for this jar to be updated. I think
that any attempts to load classes from that jar after that point may fail.

This occurs with the javadocs target which is run after the jar target. When
building ant I usually swap between JDK 1.1 and JDK 1.2/1.3 to verify that I
haven't broken ant under 1.1. I would sometimes have build failures after
swapping JDK versions but which would go away in a subsequent build. I
noticed a similar failure in Sam Ruby's last nightly build results.

I can reproduce this with the following sequence (in a batch file)
call setjdk 1.2
call bootstrap
call build dist
call setjdk 1.1
call build clean
call build dist

Because the 1.2 and 1.1 generated jars are different, the last 'build dist'
will modify the jar and then fail in the javadoc step with

java.lang.NoClassDefFoundError: org/apache/tools/ant/PathTokenizer
        at Code)
        at Code)
        at Code)
        at Code)
        at Code)

The patch below fixes the issue

If no one has any objections, I'll commit this.


Index: build.bat
RCS file: /home/cvs/jakarta-ant/build.bat,v
retrieving revision 1.6
diff -u -r1.6 build.bat
--- build.bat   2000/06/21 14:23:39     1.6
+++ build.bat   2000/06/30 16:12:20
@@ -2,4 +2,6 @@
 REM convience bat file to build with
 if exist %JAVA_HOME%\lib\tools.jar set TOOLSJAR=%JAVA_HOME%\lib\tools.jar
-java -classpath "%CLASSPATH%;%TOOLSJAR%;lib\ant.jar" %1 %2 %3 %4 %5
+copy lib\ant.jar lib\antrun.jar
+java -classpath "%CLASSPATH%;%TOOLSJAR%;lib\antrun.jar" %1 %2 %3 %4 %5
+del lib\antrun.jar
Conor MacNeill

View raw message