You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Conor MacNeill <co...@m64.com> on 2000/06/30 18:23:00 UTC

self modifying jar?

I think I have discovered a slight issue with build.bat (and presumably
build.sh). 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 org.apache.tools.ant.taskdefs.Javadoc.evaluatePackages(Compiled
Code)
        at org.apache.tools.ant.taskdefs.Javadoc.execute(Compiled Code)
        at org.apache.tools.ant.Target.execute(Compiled Code)
        at org.apache.tools.ant.Project.runTarget(Project.java:702)
        at org.apache.tools.ant.Project.executeTarget(Compiled Code)
        at org.apache.tools.ant.Project.executeTargets(Compiled Code)
        at org.apache.tools.ant.Main.runBuild(Compiled Code)
        at org.apache.tools.ant.Main.main(Main.java:106)

The patch below fixes the issue

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

Conor



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
 set TOOLSJAR=
 if exist %JAVA_HOME%\lib\tools.jar set TOOLSJAR=%JAVA_HOME%\lib\tools.jar
-java -classpath "%CLASSPATH%;%TOOLSJAR%;lib\ant.jar"
org.apache.tools.ant.Main %1 %2 %3 %4 %5
+copy lib\ant.jar lib\antrun.jar
+java -classpath "%CLASSPATH%;%TOOLSJAR%;lib\antrun.jar"
org.apache.tools.ant.Main %1 %2 %3 %4 %5
+del lib\antrun.jar
--
Conor MacNeill
Home: conor@m64.com
Work: conor@cortexebusiness.com.au
Web:  www.cortexebusiness.com.au