0

ApacheANTを使用してWebドライバースクリプトを実行しています。私のプロジェクト構造は次のとおりです。

ant_webdriver_project
 - src
   - test.ant.webdriver
     - TestLogin.java
 - JRE System Libraries
 - Referenced Libraries
    - all jars including selenium-java-2.25.0.jar, selenium-java-2.25.0-srcs.jar
 - build
 - lib
    - all jars including selenium-java-2.25.0.jar, selenium-java-2.25.0-srcs.jar
 - resources
    - myproperties.properties
 - build.xml

私のbuild.xmlファイルは次のとおりです。

<project basedir=".">

<property name="lib.dir" value="lib"/>

<path id="classpath">
    <fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>

 <target name="clean">
     <delete dir="build"/>
 </target>

 <target name="compile">
     <mkdir dir="build"/>
     <javac srcdir="src" destdir="build"/>
</target>

<target name="jar">
    <mkdir dir="build/jar"/>
    <jar destfile="build/jar/testlogin.jar" basedir="build">
         <manifest>
           <attribute name="Main-Class" value="test.ant.webdriver.TestLogin"/>
         </manifest>
    </jar>
</target>

<target name="run" depends="jar">
    <java fork="true">
    <classpath>
        <path refid="classpath"/>
        <path location="build/jar/testlogin.jar"/>
    </classpath>
    </java>

</target>

今、私がant compileに行くとき、私はこれを手に入れます:

[javac]1つのソースファイルを/home/abhijeet/Automation_Dev/automation_workspace/ant_webdriver_project/buildにコンパイルします[javac]/home/abhijeet/Automation_Dev/automation_workspace/ant_webdriver_project/src/test/ant/webdriver/TestLogin.java:11:package org .openqa.seleniumが存在しません[javac]importorg.openqa.selenium.By; [javac] ^ [javac] /home/abhijeet/Automation_Dev/automation_workspace/ant_webdriver_project/src/test/ant/webdriver/TestLogin.java:12:パッケージorg.openqa.seleniumが存在しません[javac] import org.openqa.selenium .NoSuchElementException; [javac] ^ [javac] /home/abhijeet/Automation_Dev/automation_workspace/ant_webdriver_project/src/test/ant/webdriver/TestLogin.java:13:パッケージorg.openqa.seleniumが存在しません[javac]importorg。openqa.selenium.WebDriver; 。。。

ビルドに失敗しました/home/abhijeet/Automation_Dev/automation_workspace/ant_webdriver/build.xml:18:コンパイルに失敗しました。詳細については、コンパイラのエラー出力を参照してください。

エラーは、クラスで使用したすべてのWebドライバーオブジェクトに関連しています。build.xmlの作成方法には間違いなく問題があると思いますが、多くのソースを調べましたが、解決策が見つかりませんでした。私はANTにまったく慣れていません。何か助けはありますか?

4

1 に答える 1

1

私がアリを使ってから久しぶりですが、あなたのcompileターゲットには:がありませんclasspathref

<target name="compile">
     <mkdir dir="build"/>
     <javac srcdir="src" destdir="build" classpathref="classpath" />
</target>
于 2013-01-01T22:11:56.893 に答える