ようこそ、皆さん

开心幸福生活每一天。。。

JPLT2が合格しましたが、会話と聴力はまだまだです。これからも、がんばれ!!!

antのbuild.xmlの中に、junitのtagを見つかれない

在eclipse中使用ant脚本、调用junit的task时会出现上述错误,解决方法:
1。将junit.jar 拷贝到eclipse的ant插件的目录下的lib中

2。在eclipse->windows->ant->runtime中设置ant加载的jar,增加一个外部的jar,将
     添加的junit.jar加入到ant的classpath中。


2009-03-12
现在遇到这个问题,按照上面作没有用了,难道是jdk,junit.jar包和eclipse的版本冲突了?请知道的朋友告诉我一下。。。

Buildfile: E:\02_STUDY\07_Java\workspace\JunitTestProject\build.xml
clean:
   [delete] Deleting directory E:\02_STUDY\07_Java\workspace\JunitTestProject\bin
   [delete] Directory E:\02_STUDY\07_Java\workspace\JunitTestProject\report cannot be removed using the file attribute.  Use dir instead.
copyxml:
     [copy] Copying 10 files to E:\02_STUDY\07_Java\workspace\JunitTestProject\bin\testcases
compile:
    [javac] Compiling 20 source files to E:\02_STUDY\07_Java\workspace\JunitTestProject\bin
    [javac] 注意:E:\02_STUDY\07_Java\workspace\JunitTestProject\src\com\ustcsoft\struts1\action\SampleAction.java 使用或覆盖了已过时的 API。
    [javac] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。
jar:
      [jar] Building jar: E:\02_STUDY\07_Java\workspace\JunitTestProject\dist\lib\JunitTestProject.jar
compiletests:
    [javac] Compiling 14 source files to E:\02_STUDY\07_Java\workspace\JunitTestProject\bin\testcases
    [javac] 注意:某些输入文件使用或覆盖了已过时的 API。
    [javac] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。
    [javac] 注意:E:\02_STUDY\07_Java\workspace\JunitTestProject\test\com\ustcsoft\struts2\action\ConfigTest.java 使用了未经检查或不安全的操作。
    [javac] 注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。
instrumented:
[cobertura-instrument] Cobertura 1.9.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[cobertura-instrument] Cobertura: Loaded information on 20 classes.
[cobertura-instrument] Instrumenting 20 files to E:\02_STUDY\07_Java\workspace\JunitTestProject\bin\instrumented-classes
[cobertura-instrument] Cobertura: Saved information on 20 classes.
[cobertura-instrument] Instrument time: 203ms
runtests:
    [junit] Running com.ustcsoft.homework.logic.impl.HomeWorkLogicImplTest
    [junit] java.lang.NoClassDefFoundError: org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] Exception in thread "main"

BUILD FAILED
E:\02_STUDY\07_Java\workspace\JunitTestProject\build.xml:88: Test com.ustcsoft.homework.logic.impl.HomeWorkLogicImplTest failed

Total time: 3 seconds



快快乐乐、认认真真生活才是真。

posted on 2007-09-21 14:51 鮑佩 阅读(376) 评论(3)  编辑  收藏 所属分类: ant

评论

# re: antのbuild.xmlの中に、junitのtagを見つかれない 2007-09-21 22:54 我为J狂

Are you Japnese?  回复  更多评论   

# re: antのbuild.xmlの中に、junitのtagを見つかれない 2009-03-12 16:29 鮑佩

自己的问题自己解决了。不过本人很是惭愧,原来问题的根源是anthome在中文目录当中。。。。以后要牢记了。。。。  回复  更多评论   

# re: antのbuild.xmlの中に、junitのtagを見つかれない[未登录] 2009-03-17 11:45 浪子

找到build.xml里面类似的语句,加上一句话:
<javac srcdir="${src.dir}" destdir="${classes.dir}" >
<classpath refid="classpath"/>
<compilerarg line="-source 1.5"/> <!-- 就是这句话!-->
</javac>
  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 
平平淡淡,认认真真生活才是真。