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

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

问题描述

我希望有一些人看到并有一个解决问题的解决方案,现在我正在使用ant脚本。我正在使用一个蚂蚁脚本在eclipse中编译我的java代码,但eclipse不断给我这些错误

  [junitreport]处理E: \workspace\DataOrchestrationDevelopment\DataOrchestration\Logs\jsreports\junit\html\TESTS-TestSuites.xml到C:\Users\\\Š235\AppData\Local\Temp\\\
ull1503375679
[junitreport]加载样式表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]:错误!非静态Java函数替换的第一个参数不是有效的对象引用。
[junitreport]:错误!无法将数据类型'void'转换为'引用'。
[junitreport]:致命错误!无法编译样式表
[junitreport]无法处理E:\workspace\DataOrchestrationDevelopment\DataOrchestration\Logs\jsreports\junit\html\TESTS-TestSuites.xml

BUILD FAILED
E:\workspace\DataOrchestrationDevelopment\DataOrchestration\ant\developerbuild.xml:124:执行此行时发生以下错误:
E:\workspace\ DataOrchestrationDevelopment\DataOrchestration\ant\QunitAntScript.xml:20:应用转换时的错误:转换过程中的致命错误

我的环境设置:




  • Windows 7

  • Eclipse 3.6 RC2 32位

  • JDK 1.6更新32 32位

  • Ant 1.7.2

  • Junit 4(在eclipse中):在我的项目jar文件夹我有junit-dep-4.8.2.jar



有一件事要提到,如果我使用同蚂蚁脚本,一切工作都很好,但它在日食中不起作用。我试图google上面的样式表上面的错误,但这并没有帮助我。我的猜测是在某种程度上,在eclipse内不同版本的junit被使用,但我可能是错的。

解决方案

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




  • Windows 7 x64

  • Eclipse 3.7.2(SR2)32位

  • JDK 1.6.0_32 32 -bit

  • Ant 1.7.2(来自Eclipse)或1.7.4(来自Apache,当前)

  • Junit 4.8.1(项目依赖)



我的构建在使用JDK 1.6.0_31时成功,所以看起来样式表问题是一个Ant或Java bug, Java 6 build 32.在Apache的Bugzilla系统中找不到任何报告。如果它帮助某人,这些是构建32中包含的错误修复: http://www.oracle.com/technetwork/java/javase/2col/6u32bugfixes-1579554.html



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



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



Eclipse中的中的Ant故障始于Java 6u32和Java7u4中引入的缺陷。在 Eclipse Bug#3847​​57 中报告了这个故事,其中包括允许你要使用较新的JDK。




  • 下载 org.apache.xalan code> org.apache.xml.serializer 插件从 Eclipse Orbit项目

  • 将它们复制到Java java.ext.dirs中列出的目录属性



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




  • 在Windows上: C:\Windows\Sun\Java\lib\ext

  • 在Mac上: / Users / $ USER / Library / Java / Extensions



根问题报告给Oracle,但错误不再在他们的错误数据库



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



Apache已经修复了root问题;它可能在Ant 1.9.0版本中可用( 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 bug系统还没有4.3.x里程碑)。



更新:在Eclipse中修复4.4



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


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

My environment settings:

  • Windows 7
  • Eclipse 3.6 RC2 32 bit
  • JDK 1.6 update 32 32 bit
  • Ant 1.7.2
  • Junit 4 (within eclipse): in my project jar folder I have junit-dep-4.8.2.jar

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.

解决方案

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

  • Windows 7 x64
  • Eclipse 3.7.2 (SR2) 32-bit
  • JDK 1.6.0_32 32-bit
  • Ant 1.7.2 (from Eclipse) or 1.7.4 (from Apache, current)
  • Junit 4.8.1 (project dependency)

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

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

Update: Workaround to use a newer 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

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

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

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.

Update: Apache fixed the problem in Ant

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

Update: Ant 1.9.1 scheduled for Eclipse 4.4

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).

Update: Fixed in Eclipse 4.4

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天全站免登陆