| 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-09 - By peter reilly
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)
|
|
 |