#691: JUnit Ant Task does not work
I try to execute an ant build file that contains a junit task:
If I try to run this test target from within IDEA I get the following error:
"Could not create task or type of type: junit."
Adding the above classpath element did not change anything.
Executing ant directly from the Windows 2000 command prompt works better,
except that the test fails (for unknown reasons):
C:\_main\deployment>]]>ant -buildfile build_quick.xml test
Buildfile: build_quick.xml
init:
test:
Running com.polypol.core.test.BeanUserNetworkManagerTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
BUILD FAILED
file:C:/_main/deployment/build_quick.xml:24: Test
com.polypol.core.test.BeanUser
NetworkManagerTest failed
Total time: 2 seconds
So the JUnit task had been instantiated and probably executed. Why does it
not work from within IntelliJ?
Best regards,
Michael
请先登录再写评论。
Hi Michael!
The problem has to do with how classloaders and classpaths work. See
this page for details:
http://ant.apache.org/faq.html#delegating-classloader
I solved the problem by adding /lib/optional.jar and /lib/junit.jar to the classpath when running ant (In the Ant-options dialog in IDEA). Using the 'fork="yes"' option for the ]]> task also helps (esp when running the target outside of IDEA).
cheers,
/M?ns
Michael Nestler wrote: