[junit] Problem: failed to create task or type junit with Version 2.1.1

I am having this problem with Version 2.1.1(build 4261).

specifically, it doesn't seem to recognize junit.
I get the following error:

BUILD FAILED
/home/teamcity/tomcat/buildAgent/work/Server/rb_1_0_0/build.xml:361: Problem: failed to create task or type junit
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-/usr/share/ant-core/lib
-/home/teamcity/.ant/lib
-a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem


I have tried this with both the Teamcity bundled ant, as well as the one on the system.

The junit tests run correctly if i run them from the console.

Any ideas?

4 comments

Rudy,

What kind of JUnit tests do you run, 3.8.x or 4.x?
Please try to run your build from the directory /home/teamcity/tomcat/buildAgent/work/Server/rb_1_0_0 , using command line ant. Does it work?
Please also try to remove ant home variable setting in Ant runner parameters in TeamCity UI.

Regards,
KIR

0

KIR,

We are running 4.x tests.
Running the build from the directory /home/teamcity/tomcat/buildAgent/work/Server/rb_1_0_0 using the command line ant works without any problems.

I don't have any ant home variables set in the TC UI, but I have tried it with both setting them and not.

0

Hi Rudy,

Sorry for the delay with answer - looks like forum notification system doesn't work for me :(

I'd suggest to upgrade your TeamCity to version 3.0 (or, better, 3.1 which is about to release in the beginning of the next week). We've made a lot of changes since 2.1.1 and junit4 tests work just fine for many our clients now. We had some issues with junit 4 in TC 2.1.

Kind regards,
KIR

0

Please sign in to leave a comment.