Hi Ben, Thanks for the tip! I will test this theory out when I get home. Indeed, my working directory is on a separate drive than junit.jar. Then again, I'm not sure this explains why it works when I put junit.jar into ${ant.home}/lib or why it always works for Ant-1.6.5 regardless of JDK version or location of junit.jar.
Jake Quoting "Burgess, Benjamin" <[EMAIL PROTECTED]>: > 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:[EMAIL 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. > > Jake > > Quoting Peter Reilly <[EMAIL 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 <[EMAIL 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 <[EMAIL 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: [EMAIL PROTECTED] > > > > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > >> > > > > >> > > > > > > > > > > >--------------------------------------------------------------------- > > > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > >--------------------------------------------------------------------- > > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]