Pete,
Thanks for your response.
> It is highly recomended that you NEVER in any circumstances
> have multiple
> implementations of any library sitting in classpath.
Excuse me, but there was only one DOM parser in the classpath
that *I* defined. Ant, under the covers, prepends a classpath
containing a reference to Crimson. Ant caused the multiple
reference problem.
> >To fix this you can
> >simply delete crimson/jaxp and replace with another compiler
> (ie xerces).
What's simple for an Ant expert is a little more challenging
to a novice Ant user. Examine what's necessary to "simply delete
crimson":
1. A novice's build of an application using a DOM Level 2 parser fails
with unknown namespace-related methods. What gives: %CLASSPATH%
looks good!?
2. Novice adds <echo message="${java.class.path}"> to his
build.xml to see what Ant thinks is the classpath, and discovers
that classpath now includes, at the beginning, references to jar
files in %ANT_HOME%\lib. Now where is that being done?
3. (This novice took extra step of downloading ant source,
which proved not to be necessary).
4. Look at bin\ant.bat. Oh, in :checkJava, lcp.bat is called
to modify %LOCALCLASSPATH%.
5. Aha - lcp.bat prepends!
OK, I grant you that after Step 2, deleting ant\lib\parser.java would
have been the smart move, a little less intrusive than modifying
bin\lcp.bat. But I'll have to remember to do that deletion every
time I update ant binaries.
I suggest the current lcp.bat introduces a trap for the uninitiated,
and urge you to consider a solution to the empty classpath problem
for ant builds that does not have such a significant side-effect.
Here's a possible alternative solution for lcp.bat that may address
both of our concerns:
if "%LOCALCLASSPATH%" == "" goto appendPath
set LOCALCLASSPATH=%LOCALCLASSPATH%;
:appendPath
set LOCALCLASSPATH=%LOCALCLASSPATH%%1%
Thanks,
Jim Stearns
> -----Original Message-----
> From: Peter Donald [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 26, 2001 6:42 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Bug 1126] New - bin\lcp.bat prepends Ant libraries to
> user's path
>
>
> At 12:40 27/3/01 +1000, Peter Donald wrote:
> >At 06:11 26/3/01 -0800, [EMAIL PROTECTED] wrote:
> >>+ This problem is restricted to version 1.3; version 1.2
> correctly appends
> >rather
> >>+ than prepends. I'm curious how the defect was introduced.
> >
> >because it fixed another defect. Before Ant 1.3 you could
> not build ant out
> >of the box because an empty CLASSPATH entry (if CLASSPATH
> was undefined)
> >would cause build process to fail.
> >
> >It is highly recomended that you NEVER in any circumstances
> have multiple
> >implementations of ant library sitting in classpath.
>
> That should of course read
>
> It is highly recomended that you NEVER in any circumstances
> have multiple
> implementations of any library sitting in classpath.
>
>
> >To fix this you can
> >simply delete crimson/jaxp and replace with another compiler
> (ie xerces).
>
> Cheers,
>
> Pete
>
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof." |
> | - John Kenneth Galbraith |
> *-----------------------------------------------------*
>