简体   繁体   English

用Java 1.7和ant 1.9在Eclipse中出现junit错误

[英]junit error in eclipse with java 1.7 and ant 1.9

I'm using Ant to run a series of tests and generate HTML reports using JUnit. 我正在使用Ant运行一系列测试,并使用JUnit生成HTML报告。 I get the following error: 我收到以下错误:

[junitreport] Loading stylesheet jar:file:/C:/eclipse/plugins/org.apache.ant_1.8.4.v201303080030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Could not compile stylesheet
[junitreport] : Fatal Error! Cannot convert data-type 'void' to 'reference'. Cause: Cannot convert data-type 'void' to 'reference'.

I've seen this bug in other answers, but they pointed it out as a bug introduced with Java 1.6. 我已经在其他答案中看到了该错误,但他们指出这是Java 1.6引入的错误。 I have the following set up: 我有以下设置:

  • Java JDK: 1.7.0_55 Java JDK:1.7.0_55
  • Ant: 1.9.2 蚂蚁:1.9.2

Eclipse runs ant files with it's own packaged version of ant unless you tell it otherwise. 除非另有说明,否则Eclipse将使用其自己的ant打包版本运行ant文件。 Updated my eclipse platform (and thus the pre-packaged ant) and it ran fine. 更新了我的eclipse平台(以及因此预包装的ant),并且运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM