| Ant 1.7.0 can 't find Junit in ${user.home}/.ant/lib | Ant 1.7.0 can 't find Junit in ${user.home}/.ant/lib 2007-02-10 - By Antoine Levy-Lambert
Hello Jake,
I remember that the code concerning translating File to URL has been kind of 90% rewritten between 1.6.5 and 1.7.0, and delegates more to the JDK than before.
I should have a look at your bug report on my computer in the office which has XP. I just need to download JDK 1.3.
Regards,
Antoine
On Feb 10, 2007, at 12:45 PM, Jacob Kjome wrote:
> At 02:00 PM 2/9/2007, you wrote: > >On 2/9/07, Burgess, Benjamin <BBurgess@(protected)> wrote: > >> Sounds like something I have seen before: > >> > >> http://sourceforge.net/tracker/index.php? > func=detail&aid=1468822&group_i > >> d=130558&atid=720017 > >> > >> Basically, java.net.URL.getFile() had a bug that would return an > >> incorrect String if the file is not on the same windows drive > letter as > >> the working directory. > >> > >> Ben > >> > >> -----Original Message----- > >> From: Jacob Kjome [mailto:hoju@(protected)] > >> Sent: Friday, February 09, 2007 11:36 AM > >> To: Ant Users List > >> Subject: Re: Ant 1.7.0 can't find Junit in ${user.home}/.ant/lib > >> > >> > >> I am using Windows. And it works just fine with Ant-1.6.5 no > matter the > >> JDK. > >> But under JDK1.3.1 with Ant-1.7.0, it fails (but works with > JDK1.6). My > >> user > >> home is like any normal windows machine.... > >> > >> C:\Documents and Settings\jkjome\.ant\lib > >> > >> And when I copy junit.jar from my .ant/lib to ${ant.home}/lib, > it works > >> just > >> fine. Here's my ant.home.... > >> > >> D:\java\apache-ant-1.7.0 > >> > >> > >> Can someone with a Windows machine try this? Really, I'm not > making > >> this up. > > > >Can you file a bug with the information - it is > >most likely a bug in the jdk like that described by Benjamin. > >Ant may be able to work around it. > > > >As a work-around with Ant 1.7.0, one can place > >the junit.jar file in the classpath element of the > >junit task - so perhaps > ><junit ...> > > <classpath ..> > > <fileset dir="${user.home}/.ant/lib" includes="junit*.jar"/> > > </classpath> > ></junit> > >May work? > > > > I've reported it: > http://issues.apache.org/bugzilla/show_bug.cgi?id=41587 > > The work around is easier than that. Just put it in ${ant.home}/ > lib and it works fine no matter the JDK, no matter the Ant > version. Remember Ant-1.6.5 **always** works no matter where > junit.jar is and no matter the JDK. It tried putting the build > file on my C:\ drive, the same drive as ${user.home}/.ant/lib and > it didn't make any difference. Of course, Ant itself is on my E:\ > drive, so I don't know if that makes a difference, but it doesn't > matter for Ant-1.6.5, so I don't know why it should for Ant-1.7.0? > Seems to me it's a bug in the Ant-1.7.0 <available> task, but it > only shows its ugly head under certain conditions, such as under > JDK1.3.1 on a WinXP box. > > > Jake > > >Peter > > > > > >> > >> Jake > >> > >> Quoting Peter Reilly <peter.kitt.reilly@(protected)>: > >> > >> > I have tested with JDK 1.3 and it works: > >> > ~/learning/a/junit> ant -debug > >> > Apache Ant version 1.7.0 compiled on December 13 2006 > >> > Buildfile: build.xml > >> > Adding reference: ant.PropertyHelper > >> > Detected Java version: 1.3 in: /usr/java/jdk1.3.1_18/jre > >> > Detected OS: Linux > >> > Adding reference: ant.ComponentHelper > >> > Setting ro project property: ant.file -> > >> > /home/reilly/learning/a/junit/build.xml > >> > Adding reference: ant.projectHelper > >> > Adding reference: ant.parsing.context > >> > Adding reference: ant.targets > >> > parsing buildfile /home/reilly/learning/a/junit/build.xml with > URI = > >> > file:///home/reilly/learning/a/junit/build.xml > >> > Project base dir set to: /home/reilly/learning/a/junit > >> > +Target: > >> > +Target: -check.junit.exists > >> > +Target: -check.junit > >> > +Target: build.something > >> > Attempting to create object of type > >> > org.apache.tools.ant.helper.DefaultExecutor > >> > Adding reference: ant.executor > >> > Build sequence for target(s) `build.something' is > >> > [-check.junit.exists, -check.junit, build.something] > >> > Complete build sequence is [-check.junit.exists, -check.junit, > >> > build.something, ] > >> > > >> > -check.junit.exists: > >> > [antlib:org.apache.tools.ant] Could not load definitions from > resource > >> > org/apache/tools/ant/antlib.xml. It could not be found. > >> > Setting project property: junit.exists -> true > >> > > >> > -check.junit: > >> > Skipped because property 'junit.exists' set. > >> > > >> > build.something: > >> > > >> > BUILD SUCCESSFUL > >> > Total time: 0 seconds > >> > > >> > > >> > Are you running on windows? > >> > If so there may be the usual problems with spaces and > >> > perhaps the location of user.home. > >> > > >> > Peter > >> > > >> > On 2/9/07, Jacob Kjome <hoju@(protected)> wrote: > >> > > > >> > > Hi Peter, > >> > > > >> > > Can you take another look at this? I apologize that I did > not point > >> > > it out in the original email, but the problem is > specifically with > >> > > older JVM's such as JDK1.3.1. I happened to be using it for > >> building > >> > > the project where I found the problem. I just didn't > realize it was > >> > > specific to JDK1.3.1 until I tried with JDK1.6. I only > tried JDK1.6 > >> > > after you failed to reproduce the behavior and I saw you > were using > >> JDK1.5. > >> > > > >> > > I think this got lost in the shuffle of the current > religious debate > >> > > over whether XML is a scripting language. How about we fix > this > >> > > issue first and then move on to that never-ending debate. BTW, > >> > > everyone realizes that the Gant project exists, right? > >> > > > >> > > http://groovy.codehaus.org/Gant > >> > > > >> > > > >> > > Jake > >> > > > >> > > At 10:27 AM 2/7/2007, you wrote: > >> > > > > >> > > >Hi Peter, > >> > > > > >> > > >I narrowed it down. Indeed, your findings are correct.... > for JDK > >> > > >1.5 (or JDK 1.6 on my machine). Try it under JDK 1.3.1. > That's > >> when > >> > > >it fails to find Junit.jar unless junit.jar is under > >> > > >${ant.home}/lib. Not sure about JDK 1.4.x since I don't > care to > >> install > >> > it. > >> > > > > >> > > >Jake > >> > > > > >> > > >At 02:57 AM 2/7/2007, you wrote: > >> > > > >Just tested with ant 1.7.0 and this does not happen > >> > > > >for me - the available does find junit in ~/.ant/lib > >> > > > > > >> > > > >build.xml: > >> > > > > > >> > > > > <target name="-check.junit.exists"> > >> > > > > <available classname="junit.framework.TestCase" > >> > > > > property="junit.exists" value="true"/> > >> > > > > </target> > >> > > > > > >> > > > > <target name="-check.junit" depends="-check.junit.exists" > >> > > > > unless="junit.exists"> > >> > > > > <echo>JUnit is not currently available to the build > >> environment. > >> > > > > Because of this, all targets that require JUnit > will be > >> skipped. > >> > To > >> > > > > enable these targets, place a copy of JUnit (get > latest > >> version > >> > at > >> > > > > http://www.junit.org/) in ANT_HOME/lib.</echo> > >> > > > > </target> > >> > > > > > >> > > > > > >> > > > > <target name="build.something" depends="-check.junit" > >> > if="junit.exists"> > >> > > > > </target> > >> > > > ></project> > >> > > > > > >> > > > >~/learning/a/junit> ls -l ~/.ant/lib > >> > > > >total 128 > >> > > > >-rw-r--r-- 1 reilly ccgrp01 120640 Feb 7 2007 > junit-3.8.2.jar > >> > > > >~/learning/a/junit> ant -debug > >> > > > >Apache Ant version 1.7.0 compiled on December 13 2006 > >> > > > >Buildfile: build.xml > >> > > > >Adding reference: ant.PropertyHelper > >> > > > >Detected Java version: 1.5 in: /usr/java/jdk1.5.0_09/jre > >> > > > >Detected OS: Linux > >> > > > >Adding reference: ant.ComponentHelper > >> > > > >Setting ro project property: ant.file -> > >> > > > >/home/reilly/learning/a/junit/build.xml > >> > > > >Adding reference: ant.projectHelper > >> > > > >Adding reference: ant.parsing.context > >> > > > >Adding reference: ant.targets > >> > > > >parsing buildfile /home/reilly/learning/a/junit/ > build.xml with > >> URI = > >> > > > >file:/home/reilly/learning/a/junit/build.xml > >> > > > >Project base dir set to: /home/reilly/learning/a/junit > >> > > > > +Target: > >> > > > > +Target: -check.junit.exists > >> > > > > +Target: -check.junit > >> > > > > +Target: build.something > >> > > > >Attempting to create object of type > >> > > >org.apache.tools.ant.helper.DefaultExecutor > >> > > > >Adding reference: ant.executor > >> > > > >Build sequence for target(s) `build.something' is > >> > > > >[-check.junit.exists, -check.junit, build.something] > >> > > > >Complete build sequence is [-check.junit.exists, - > check.junit, > >> > > > >build.something, ] > >> > > > > > >> > > > >-check.junit.exists: > >> > > > >[antlib:org.apache.tools.ant] Could not load definitions > from > >> resource > >> > > > >org/apache/tools/ant/antlib.xml. It could not be found. > >> > > > >Setting project property: junit.exists -> true > >> > > > > > >> > > > >-check.junit: > >> > > > >Skipped because property 'junit.exists' set. > >> > > > > > >> > > > >build.something: > >> > > > > > >> > > > >BUILD SUCCESSFUL > >> > > > >Total time: 0 seconds > >> > > > >~/learning/a/junit> rm ~/.ant/lib/junit-3.8.2.jar > >> > > > >~/learning/a/junit> ant > >> > > > >Buildfile: build.xml > >> > > > > > >> > > > >-check.junit.exists: > >> > > > > > >> > > > >-check.junit: > >> > > > > [echo] JUnit is not currently available to the build > >> environment. > >> > > > > [echo] Because of this, all targets that require > >> JUnit will > >> > > > >be skipped. To > >> > > > > [echo] enable these targets, place a copy of > JUnit > >> (get > >> > > > >latest version at > >> > > > > [echo] http://www.junit.org/) in ANT_HOME/lib. > >> > > > > > >> > > > >build.something: > >> > > > > > >> > > > >BUILD SUCCESSFUL > >> > > > >Total time: 0 seconds > >> > > > >~/learning/a/junit> > >> > > > > > >> > > > >Peter > >> > > > > > >> > > > > > >> > > > > > >> > > > >On 2/7/07, Jacob Kjome <hoju@(protected)> wrote: > >> > > > >> > >> > > > >> Maybe this is a known issue, but it appears that > Junit.jar > >> must be in > >> > > > >> ${ant.home}/lib in order to be discovered, at least by > the > >> > > > >> <available> task using Ant-1.7.0. In Ant-1.6.5, Junit is > >> found just > >> > > > >> fine in ${user.home}/.ant/lib, but not in Ant-1.7.0. For > >> instance... > >> > > > >> > >> > > > >> <target name="-check.junit.exists"> > >> > > > >> <available classname="junit.framework.TestCase" > >> > > > >> property="junit.exists" value="true"/> > >> > > > >> </target> > >> > > > >> > >> > > > >> <target name="-check.junit" depends="- > check.junit.exists" > >> > > > >> unless="junit.exists"> > >> > > > >> <echo>JUnit is not currently available to the build > >> environment. > >> > > > >> Because of this, all targets that require JUnit will be > >> skipped. To > >> > > > >> enable these targets, place a copy of JUnit (get latest > >> version at > >> > > > >> http://www.junit.org/) in ANT_HOME/lib.</echo> > >> > > > >> </target> > >> > > > >> > >> > > > >> > >> > > > >> <target name="build.something" depends="-check.junit" > >> > > if="junit.exists"> > >> > > > >> ...... > >> > > > >> </target> > >> > > > >> > >> > > > >> > >> > > > >> With junit.jar in ${user.home}/.ant/lib and using > Ant-1.7.0, I > >> always > >> > > > >> get the <echo> message. If I move junit.jar to > >> ${ant.home}/lib, I > >> > > > >> don't get the <echo> message. Ant-1.6.5 doesn't care > where I > >> put > >> > > > >> it. It finds junit.jar in either location. > >> > > > >> > >> > > > >> Is this a known issue? Has it already been fixed for > >> Ant-1.7.1? > >> > > > >> > >> > > > >> > >> > > > >> Jake > >> > > > >> > >> > > > >> > >> > > > >> > >> > --------------------------------------------------------------------- > >> > > > >> To unsubscribe, e-mail: user-unsubscribe@(protected) > >> > > > >> For additional commands, e-mail: user-help@(protected) > >> > > > >> > >> > > > >> > >> > > > > > >> > > > > >> > >--------------------------------------------------------------------- > >> > > > >To unsubscribe, e-mail: user-unsubscribe@(protected) > >> > > > >For additional commands, e-mail: user-help@(protected) > >> > > > > > >> > > > > > >> > > > > > >> > > > > >> > > > > >> > > > >> > >--------------------------------------------------------------------- > >> > > >To unsubscribe, e-mail: user-unsubscribe@(protected) > >> > > >For additional commands, e-mail: user-help@(protected) > >> > > > > >> > > > > >> > > > > >> > > > >> > > > >> > > > >> > --------------------------------------------------------------------- > >> > > To unsubscribe, e-mail: user-unsubscribe@(protected) > >> > > For additional commands, e-mail: user-help@(protected) > >> > > > >> > > > >> > > >> > > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: user-unsubscribe@(protected) > >> > For additional commands, e-mail: user-help@(protected) > >> > > >> > >> > >> > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@(protected) > >> For additional commands, e-mail: user-help@(protected) > >> > >> > >> > >> ************************************************************** > >> This message, including any attachments, contains confidential > >information intended for a specific individual and purpose, and is > >protected by law. If you are not the intended recipient, please > >contact sender immediately by reply e-mail and destroy all copies. > >You are hereby notified that any disclosure, copying, or distribution > >of this message, or the taking of any action based on it, is strictly > >prohibited. > >> TIAA-CREF > >> ************************************************************** > >> > >> > >> > --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@(protected) > >> For additional commands, e-mail: user-help@(protected) > >> > >> > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: user-unsubscribe@(protected) > >For additional commands, e-mail: user-help@(protected) > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@(protected) > For additional commands, e-mail: user-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|
 |