0

Ant を使用して xslt レポートを生成しようとしている Selenium ユーザーですが、cmd で Ant を実行すると、プロジェクト フォルダーに build.xml ファイルがあるのに build.xml が存在しないというエラーが表示されます。

  1. Windows 7でeclispe junoを使用しており、プロジェクトの下にbuild.xmlファイルを保持しています。
  2. 私のマシンには Java JDK1.7 があり、apache.org の指示に従って環境変数 (Java と ant の両方) を既に設定しています。
  3. Ant のバージョンは apache-ant-1.9.1 です
  4. 必要なすべてのjarファイル(セレン+ maven + saxon + antを介したxsltレポートに必要なすべて)をEclipseのプロジェクトにインポートしました。cmdを介してantを実行しようとすると、次のエラーが表示されます:-

ビルドに失敗しました

D:\Projects\Project\Selenium\Workspace\build.xml:70: Compile failed; see the compiler error output for details.

以下は私のbuild.xmlファイルです:-

<project name="Plumslice" default="usage" basedir=".">


<property environment="env"/>
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="D:\All jars"/>
<property name="test.dest" value="${ws.home}/build"/>
<property name="test.src" value="${ws.home}/src"/>
<property name="ng.result" value="test-output"/>

<!--target name="start-selenium-server">
<java jar="${ws.home}/lib/selenium-server.jar"/>
</target-->

<target name="setClassPath" unless="test.classpath">
<path id="classpath_jars">
<fileset dir="${ws.jars}" includes="*.jar"/>
</path>
<pathconvert pathsep=":"
property="test.classpath"
refid="classpath_jars"/>
</target>

<target name="init" depends="setClassPath">
<tstamp>
<format property="start.time" pattern="MM/dd/yyyy hh:mm aa" />
</tstamp>
<condition property="ANT"
value="${env.ANT_HOME}/bin/ant.bat"
else="${env.ANT_HOME}/bin/ant">
<os family="windows" />
</condition>
<taskdef name="testng" classpath="${test.classpath}"
classname="org.testng.TestNGAntTask" />

</target>

<!-- all -->
<target name="all">
</target>

<!-- clean -->
<target name="clean">
<delete dir="${test.dest}"/>
</target>


<!-- compile -->
<target name="compile" depends="init, clean" >
<delete includeemptydirs="true" quiet="true">
<fileset dir="${test.dest}" includes="**/*"/>
</delete>
<echo message="making directory..."/>
<mkdir dir="${test.dest}"/>
<echo message="classpath------: ${test.classpath}"/>
<echo message="compiling..."/>

<javac
debug="true"
destdir="${test.dest}"
srcdir="${test.src}"
target="1.7"
classpath="${test.classpath}">
</javac>
<copy todir="${test.dest}">
<fileset dir="${test.src}" excludes="**/*.java"/>
</copy>
</target>


<!-- build -->
<target name="build" depends="init">
</target>

<!-- run -->
<target name="run" depends="compile">
<testng classpath = "${test.classpath}:${test.dest}" suitename = "suite1" >
<xmlfileset dir="${ws.home}" includes="testng.xml"/>
</testng>
<!--
<testng classpath="${test.classpath}:${test.dest}" groups="fast">
<classfileset dir="${test.dest}" includes="example1/*.class"/>
</testng>
-->
</target>




<target name="usage">
<echo>
ant run will execute the test
</echo>
</target>


<path id="test.c">
<fileset dir="${ws.jars}" includes="*.jar"/>

</path>

<target name="email" >
<java classname="com.qtpselenium.util.SendMail" classpath="${test.dest}" classpathref="test.c" />
</target>

      <target name="makexsltreports">
                <mkdir dir="${ws.home}/XSLT_Reports/output"/>

                <xslt in="${ng.result}/testng-results.xml" style="src/com/testing/xslt/testng-results.xsl"
                      out="${ws.home}/XSLT_Reports/output/index.html" classpathref="test.c" processor="SaxonLiaison">
                    <param name="testNgXslt.outputDir" expression="${ws.home}/XSLT_Reports/output/"/>
                    <param name="testNgXslt.showRuntimeTotals" expression="true"/>
                </xslt>
            </target>


</project>
4

1 に答える 1

0

ご協力いただきありがとうございます。エラーを解決しました..

それはjarファイルのパスに関連していました.jarファイルへのパスが間違っていました。

これは70行目でした: -

        <javac debug="true" destdir="${test.dest}" srcdir="${test.src}"
        target="1.7" classpath="${test.classpath}">

これはjarへのパスに関連しており、ファイルの一番上の行でこのパスを提供しました- D:\All jars 、必要なすべてのjarがこのフォルダーにありませんでしたが、jarフォルダーを更新しましたが、正常に動作しています今。

于 2013-09-06T12:58:51.463 に答える