Ant - junit, build failed= Could not create task or type of type junit

Q: Ant - junit, build failed: Could not create task or type of type: junit

When running JUnit tasks in ant and you get the following error:

BUILD FAILED
path\to\Geoserver\build.xml:259: Could not create task or type of type: junit.
Ant could not find the task or a class this task relies upon.

To fix this problem, you need to copy a JUnit.jar file to your eclipse/plugins/org.apache.ant/lib directory
Next you need to go into Eclipse then click on Window->Preferences->ant->Runtime, then select 'Ant Home Entries (Default). Click on the button 'Add External JARs'. Locate the junit.jar file you copied, select it and hit 'OK'. Hit 'Apply', then 'OK' and try your ant task again. That should fix it.

Added by bowens, last edited by bowens on Nov 17, 2005  (view change)

Comments

Anonymous says:

This hint has been very heplful to me.
I had a similar problem, but with the scp-task. I had to place a copy of jsch.jar in the directory, then I could run the target containing the scp-task out of eclipse.   Before I had to do it via command-line.

Anonymous says:

I faced the same problem in Eclipse.The tip was very useful.

Anonymous says:

I must agree.  Excellent tip.  Clear and concise.

Anonymous says:

very helpful hint .. before that i was just trying by adding junit jar in plugin lib folder but i wasnt aware of that window -> prefrence linking procedure thanks buddy

Anonymous says:

Also help me so much , thanks U.

Jan

Anonymous says:

very helpful solution to resolve the problem. thanks

Anonymous says:

I have the same problem with scp task for ant under eclipse. But the lib ant-jsch.jar already exists in the correct location (eclipse/plugins/org.apache.ant/lib directory)....

Simona 

Anonymous says:

That nailed it - Thanks!

michelle.m.yan@lmco.com says:

Hi,

My problem is odd, I can run my junit task without any problems on both Eclipse and command line, but not Linux box!

I got this error:
Could not create task or type of type: junit.

Please help! Best regards.

mahesh.mudigonda@gmail.com says:

awesome Tip. worked like magic... thanks for the tip

View Attachments (0) Info