How to resolve taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[] in build.xml file

7,266 views
Skip to first unread message

Er. Debasish Dutta

unread,
Apr 1, 2015, 9:42:09 PM4/1/15
to testng...@googlegroups.com
While creating testng project and we want to import the build.xml file to the project to run it through ant. after importing the build.xml file we may get the below error

taskdef class org.testng.TestNGAntTask cannot be found using the classloader AntClassLoader[]

So create a separate folder to store all the jars and pass that path to the jars property

 <property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="D:\TestngJar"/>  here you can see i have stored all the jar files in the folder TestNgJar
    <property name="test.dest" value="${ws.home}/build"/>
    <property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="test-output"/>


Raj Vasikarla

unread,
Apr 1, 2015, 9:45:03 PM4/1/15
to testng...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

pdfngreport

unread,
Apr 2, 2015, 11:58:17 AM4/2/15
to testng...@googlegroups.com
use below block in your build.xml file and point to testng jar location which will resolve that error.
 
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement location="ext-lib/testng-6.8.5.jar"/>
</classpath>
</taskdef>

balu selenium

unread,
Dec 23, 2017, 1:23:11 AM12/23/17
to testng-users
     <taskdef name="testng" classpath="${testng.classpath}"
               classname="org.testng.TestNGAntTask" />

<property name="testng.classpath" value="c:/testng/testng.jar"/>


Ensure that you have testng.jar file in the path 


thanks
Reply all
Reply to author
Forward
0 new messages