蚂蚁< junitreport>失败,因为Xalan的(XSLT)安全处理功能 [英] Ant <junitreport> fail because of Xalan's (XSLT) secure processing feature

查看:206
本文介绍了蚂蚁< junitreport>失败,因为Xalan的(XSLT)安全处理功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的JUnit测试通过从我的Eclipse环境中蚂蚁1.7,但在执行的任务junitreport构建failes运行:

My junit tests run via ant 1.7 from within my Eclipse environment but the build failes when the junitreport task is performed:

构建失败
  ... / build.xml文件:222:同时应用转换错误:
  javax.xml.transform.TransformerException中:了java.lang.RuntimeException:
  扩展功能的使用://org.apache.tools.ant.util.StringUtils:xalan的替换
  当安全处理功能设置为true,是不允许的。

BUILD FAILED .../build.xml:222: Errors while applying transformations: javax.xml.transform.TransformerException: java.lang.RuntimeException: Use of the extension function 'xalan://org.apache.tools.ant.util.StringUtils:replace' is not allowed when the secure processing feature is set to true.

我试图找出如何使junitreport任务禁用安全处理功能(我不需要,仅在我的方式在这一点),但我不知道如何,因为任务没有一个属性来禁用它。或者我应该做别的事情,使这项工作?

I tried to figure out how to make the junitreport task disable the secure processing feature (which I don't need and is only in my way at this point) but I have no clue how since the task doesn't have an attribute to disable it. Or should I do something else to make this work?

推荐答案

这可能与一个非常类似的在蚂蚁1.8.2 已知的bug。

This may be related to a very similar known bug in Ant 1.8.2.

Ant的修正错误1.8.3 一直致力于,但Apache Ant的1.8.3还没有被释放扬25 2012年WHATSNEW说明对这一错误修正为:

The bugfix for Ant 1.8.3 has been committed, but Apache Ant 1.8.3 has yet to be released as of Jan 25 2012. The WHATSNEW description for this bugfix is:

<junitreport> did not work in embedded environments on JDK 7.
Bugzilla Report 51668.

在蚂蚁1.8.3被释放并且被掺入到Eclipse蚂蚁插件,这个问题应该得以解决。

Once Ant 1.8.3 is released and is incorporated into the Eclipse Ant plugin, this issue should be resolved.

在此期间,你可以因此只有当从命令行运行Ant的,而不是在Eclipse运行JUnitReport目标编辑生成脚本。要做出此决定,寻找一个文件present常规的%ANT_HOME%/ lib目录文件夹,是不是在你的Eclipse的Ant插件文件夹present(或创建文件那里),然后,如果检测到文件设置一个属性。例如。

In the meantime, you can edit your build script so it only runs the JUnitReport target if running Ant from a command line, rather than from within Eclipse. To make this determination, look for a file present in your regular %ANT_HOME%/lib folder that is not present in your Eclipse Ant plugin folder (or create a file there), then set a property if the file is detected. E.G.

只是你的JUnit目标年底前:

Just before the end of your JUnit target:

<available file="${ant.home}/lib/ant.pom" property="full.ant"/>

在你JUnitReport目标的开头:

At the beginning of your JUnitReport target:

  <target name="junitreport" description="Create a consolidated test results report" if="full.ant">

以上蚂蚁片段工作,因为 ant.home 设置为只有当蚂蚁是在Eclipse中运行Eclipse的Ant插件文件夹中。当蚂蚁从从命令行运行, ant.home 将匹配您的 ANT_HOME 环境变量。另外也应该是一个 eclipse.running Ant属性,但我无法检测到该属性。

The above Ant fragments work because ant.home is set to the Eclipse Ant Plugin folder only when Ant is run from within Eclipse. When Ant is run from a command line, ant.home will match your ANT_HOME environment variable. There is also supposed to be an eclipse.running Ant property, but I could not detect this property.

另一种临时方法是从此链接上该APACH Ant项目页面,然后将相应的Eclipse的Ant插件子文件夹中的JAR文件。没有保证,这将正常工作。

Another interim option is to download the newest JAR files of Ant nightly builds from this link on the Apach Ant project page, then placing those JAR files within the corresponding Eclipse Ant plugin sub-folder. No guarantees this will work.

这篇关于蚂蚁&LT; junitreport&GT;失败,因为Xalan的(XSLT)安全处理功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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