eclipse中的ant junit构建错误 [英] ant junit build error inside eclipse

查看:22
本文介绍了eclipse中的ant junit构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人已经看到并解决了我现在使用 ant 脚本遇到的问题.我正在使用 ant 脚本在 eclipse 中编译我的 java 代码,但 eclipse 不断给我这些错误

I am hoping there are some people who have seen and have a solution for the problem that I am having right now with ant script. I am using an ant script to compile my java codes in eclipse but eclipse keeps giving me these errors

[junitreport] Processing E:\workspace\DataOrchestrationDevelopment\DataOrchestration\Logs\jsreports\junit\html\TESTS-TestSuites.xml to C:\Users\u0160235\AppData\Local\Temp\null1503375679
[junitreport] Loading stylesheet jar:file:/E:/software/apache/apache-ant-1.8.2/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! Cannot convert data-type 'void' to 'reference'.
[junitreport] : Fatal Error! Could not compile stylesheet
[junitreport] Failed to process E:\workspace\DataOrchestrationDevelopment\DataOrchestration\Logs\jsreports\junit\html\TESTS-TestSuites.xml

BUILD FAILED
E:\workspace\DataOrchestrationDevelopment\DataOrchestration\ant\developerbuild.xml:124: The following error occurred while executing this line:
E:\workspace\DataOrchestrationDevelopment\DataOrchestration\ant\QunitAntScript.xml:20: Errors while applying transformations: Fatal error during transformation

我的环境设置:

  • Windows 7
  • Eclipse 3.6 RC2 32 位
  • JDK 1.6 更新 32 32 位
  • 蚂蚁 1.7.2
  • Junit 4(在 Eclipse 中):在我的项目 jar 文件夹中,我有 junit-dep-4.8.2.jar

要提一提的是,如果我在 eclipse 之外使用相同的 ant 脚本编译我的代码,一切正常,但它在 eclipse 中不起作用.我试图用谷歌搜索上面样式表上方的错误,但这对我没有多大帮助.我的猜测是不知何故,在 eclipse 中使用了不同版本的 junit,但我可能是错的.

One thing to mention that if I compile my codes outside eclipse using the same ant script, everything works just fine, but it doesn't work inside eclipse. I tried to google the errors above the stylesheet above, but that didn't help me much. My guess is somehow, within eclipse different version of junit is being used, but I might be wrong.

推荐答案

我在使用以下环境的 Eclipse 中遇到了相同的样式表问题:

I experienced the same stylesheet problem within Eclipse using the following environment:

  • Windows 7 x64
  • Eclipse 3.7.2 (SR2) 32 位
  • JDK 1.6.0_32 32 位
  • Ant 1.7.2(来自 Eclipse)或 1.7.4(来自 Apache,当前)
  • Junit 4.8.1(项目依赖项)

我在使用 JDK 1.6.0_31 时构建成功,因此样式表问题似乎是随着 Java 6 build 32 的发布而引入的 Ant 或 Java 错误.我在 Apache 的 Bugzilla 系统中找不到任何报告.如果它对某人有帮助,这些是构建 32 中包含的错误修复:http://www.oracle.com/technetwork/java/javase/2col/6u32bugfixes-1579554.html

My build succeeds while using JDK 1.6.0_31, so it appears the stylesheet problem is an Ant or Java bug introduced with the release of Java 6 build 32. I could not find any reports in Apache's Bugzilla system. If it helps someone, these are the bug fixes included in build 32: http://www.oracle.com/technetwork/java/javase/2col/6u32bugfixes-1579554.html

我目前的解决方法是使用 Java 6 JDK build 31.

My current workaround is to use Java 6 JDK build 31.

更新:使用较新 JDK 的解决方法

Eclipse 中的 Ant 故障始于 Java 6u32 和 Java7u4 中引入的缺陷.Eclipse Bug #384757 中报告了该传奇,包括允许您可以使用较新的 JDK.

The Ant failures from within Eclipse started with a defect introduced in Java 6u32 and Java7u4. The saga is reported in Eclipse Bug #384757, including a workaround allowing you to use newer JDKs.

  • Download the org.apache.xalan and org.apache.xml.serializer plug-ins from the Eclipse Orbit project
  • Copy them to a directory listed in the Java java.ext.dirs property

我使用以下目录,因为它们是默认定义的并且与 JDK 版本无关:

I use the following directories because they are defined by default and independent of JDK version:

  • 在 Windows 上:C:\Windows\Sun\Java\lib\ext
  • 在 Mac 上:/Users/$USER/Library/Java/Extensions

根本问题已报告给 Oracle,但 该错误不再存在他们的错误数据库.我并不乐观它会被修复.

The root problem was reported to Oracle, but the bug is no longer in their bug database. I am not optimistic it will ever be fixed.

更新:Apache 修复了 Ant 中的问题

Apache 已经修复了根本问题;它可能在 Ant 1.9.0 版本中可用(Apache Bug #54641).

Apache has fixed the root problem; it may be available in the Ant 1.9.0 release (Apache Bug #54641).

更新:Ant 1.9.1 计划用于 Eclipse 4.4

正如@OliBlogger 提到的,Apache 修复了 Ant 1.9.1 中的根本问题.Eclipse 计划在 Eclipse 4.4 中更新到 Ant 1.9.1(也许很快,Eclipse 漏洞系统还没有 4.3.x 里程碑).

As @OliBlogger mentioned, Apache fixed the root problem in Ant 1.9.1. Eclipse plans to update to Ant 1.9.1 in Eclipse 4.4 (perhaps sooner, the Eclipse bug system does not yet have 4.3.x milestones).

更新:在 Eclipse 4.4 中修复

我确认我的构建现在成功使用 Java 7 JDK build 67 和 Ant 1.9.2 与 Eclipse 4.4.1 (Windows 7) 一起分发,而不使用 Orbit 插件解决方法.

I confirmed that my build now succeeds using Java 7 JDK build 67 and Ant 1.9.2 distributed with Eclipse 4.4.1 (Windows 7) without using the Orbit plug-in workaround.

这篇关于eclipse中的ant junit构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆