应用转换时出错 - 当安全处理功能设置为true时,不允许使用扩展元素“重定向”

时间:2012-06-06 07:41:40

标签: eclipse testing ant junit

请帮我修复此错误和警告:

41:警告:'includeantruntime'未设置,默认为build.sysclasspath = last;对于可重复的构建设置为false

79:应用转换时出错:javax.xml.transform.TransformerException:java.lang.RuntimeException:当安全处理功能设置为true时,不允许使用扩展元素'redirect'。

总时间:31秒

这是我的build.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
          Any modifications will be overwritten.
          To include a user specific buildfile here, simply create one in the same
          directory with the processing instruction <?eclipse.ant.import?>
          as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="Login">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../../../opt/eclipse"/>
<property name="junit.output.dir" value="junit"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Login.classpath">
    <pathelement location="bin"/>
    <pathelement location="../../Downloads/JAR/junit-4.10.jar"/>
    <pathelement location="../../Downloads/JAR/poi-3.2-FINAL.jar"/>
    <pathelement location="../../Downloads/JAR/selenium-java-2.21.0.jar"/>
    <pathelement location="../../Downloads/JAR/selenium-java-2.21.0.zip"/>
    <pathelement location="../../Downloads/JAR/selenium-java-2.21.0-srcs.jar"/>
    <pathelement location="../../Downloads/JAR/selenium-server-standalone-2.21.0.jar"/>
    <pathelement location="../../Downloads/JAR/testng-6.5.1.zip"/>
</path>
<target name="init">
    <mkdir dir="bin"/>
    <copy includeemptydirs="false" todir="bin">
        <fileset dir="src">
            <exclude name="**/*.launch"/>
            <exclude name="**/*.java"/>
        </fileset>
    </copy>
</target>
<target name="clean">
    <delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
    <echo message="${ant.project.name}: ${ant.file}"/>
    <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">

        <src path="src"/>
        <classpath refid="Login.classpath"/>
    </javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
    <copy todir="${ant.library.dir}">
        <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
    </copy>
    <unzip dest="${ant.library.dir}">
        <patternset includes="jdtCompilerAdapter.jar"/>
        <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
    </unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
    <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
    <antcall target="build"/>
</target>
<target name="login.testLogin">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="login" todir="${junit.output.dir}"/>
        <classpath refid="Login.classpath"/>
    </junit>
</target>
<target name="login">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
        <test name="login" todir="${junit.output.dir}"/>
        <classpath refid="Login.classpath"/>
    </junit>
</target>

<target name="junitreport">
    <junitreport todir="${junit.output.dir}">
        <fileset dir="${junit.output.dir}">
            <include name="TEST-*.xml"/>
        </fileset>
        <report format="frames" todir="${junit.output.dir}"/>
    </junitreport>
</target>

<target name="compile">
    <mkdir dir="${classes.dir}"/>
    <javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
        <classpath>
            <path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
            <path id="junit" location="${lib.dir}/junit-4.9b2.jar"/>
        </classpath>
    </javac>
</target>
</project>

2 个答案:

答案 0 :(得分:3)

对于警告,请将includeantruntime添加到javac目标。 请按照以下链接获取更多信息。 ant warning: "'includeantruntime' was not set"

答案 1 :(得分:1)

您的Ant版本是什么?

links讨论1.8.3中的修复