ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Ant 1.7.0 can't find Junit in ${user.home}/.ant/lib
Date Wed, 07 Feb 2007 16:27:06 GMT

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@visi.com> 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@ant.apache.org
 >> For additional commands, e-mail: user-help@ant.apache.org
 >>
 >>
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
 >For additional commands, e-mail: user-help@ant.apache.org
 >
 >
 > 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message