[EMAIL PROTECTED] wrote:

The problem is (not tested :) that the "junit" task is defined during
parsing
stage of the ant.jar!/.../taskdefs/default.properties. The class should be
loaded
then by first use of <junit>.
The <taskdef> between wouldnt work ... IMO.

For test: give it another taskname
 <taskdef name="my.junit" .../>



No this is not the case.
the junit task needs to moved out of $ANT_HOME/lib, otherwise
it gets loaded by ant's project classloader which does not
see junit.jar.

The easiest solution is to place junit.jar in $ANT_HOME/lib,
the second easiest is to use ant -lib $JUNIT_HOME/lib/junit.jar (or
whereever junit.jar is)
the third solution is to read:
http://ant.apache.org/faq.html#delegating-classloader
very carefully.

Peter

Jan



-----Urspr�ngliche Nachricht-----
Von: Danilo B�rger
[mailto:[EMAIL PROTECTED]
Gesendet am: Montag, 14. M�rz 2005 15:26
An: Ant Users List
Betreff: Re: Junit Integration Problem

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

i think you meant classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"?
i tried with that and it actually finds the task, but cant satisfy the dependency with junit.jar:


BUILD FAILED: build.xml:83: taskdef A class needed by class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask cannot be found: junit/framework/Test

I heard that you shouldnt use ant-junit.jar with the taskdef at all, but instead use the junit.jar classloader, but what classname should i specify for that?

Thanks in advance

Am 14.03.2005 um 07:26 schrieb Antoine Levy-Lambert:



Hello Danilo,
you need to taskdef junit in your build file, specifying a


classpath

which includes ant-junit.jar and junit.jar.
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.JunitTask">
<classpath>
<pathelement location="path of junit.jar"/>
<pathelement location="path of ant-junit.jar"/>
</classpath>
</taskdef>


Cheers,
Antoine

Danilo B�rger wrote:



I would like to integrate Junit into Ant as specified by 3. in
http://ant.apache.org/manual/OptionalTasks/junit.html ("3.


Do neither


of the above, and instead, specify their locations using a

<classpath>


element in the build file.  See the FAQ for details.")

Now i have the junit.jar (3.8.1) and also the xalan.jar in

my projects


lib/ directory. I have the following target:

    <path id="class.path" description="The main build classpath">
        <pathelement location="${build.dir}/classes"/>
        <fileset dir="${lib.dir}" includes="**/*.jar"/>
    </path>

    <target name="junit" depends="..." description="...">
        <junit printsummary="yes">
            <classpath refid="class.path"/>
        </junit>
    </target>

I am still getting the famous "Ant could not find the task

or a class


this task relies upon." error.







---------------------------------------------------------------------


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Darwin)

iD8DBQFCNZ8rFG7pbP1EbVMRAmuJAJ0WJ77GKPbXXdTFQdB/UD6VnJI/UQCgjpP1
mTEtfYoBbzBie3Oya8gtA7w=
=d7+r
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- 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]



Reply via email to