0

所以我安装了ant并尝试编写一个xml文件并尝试构建我的webdriver java代码(在windows server 2003中)。但我无法构建该项目。它抛出了很多错误。这是我的构建文件

<?xml version="1.0" encoding="UTF-8"?>

<project default="run" name="title">
<target name="run" depends="compile">
</target>
<target name="compile">
<javac includeantruntime="false" srcdir="./src" destdir="staging"/>
</target>
</project>

这是我收到的构建失败错误消息

 [javac] Compiling 4 source files to G:\Documents and Settings\Administrator\eworkspace\Sample\staging
[javac] G:\Documents and Settings\Administrator\eworkspace\Sample\src\Login.java:1: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.WebDriver;
[javac]                           ^
[javac] G:\Documents and Settings\Administrator\eworkspace\Sample\src\Login.java:2: error: package org.openqa.selenium.firefox does not exist
[javac] import org.openqa.selenium.firefox.FirefoxDriver;
[javac]                                   ^
[javac] G:\Documents and Settings\Administrator\eworkspace\Sample\src\lib_files\Login.java:7: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.By;
[javac]                           ^
[javac] G:\Documents and Settings\Administrator\eworkspace\Sample\src\lib_files\Login.java:8: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.JavascriptExecutor;
[javac]                           ^
[javac] G:\Documents and Settings\Administrator\eworkspace\Sample\src\lib_files\Login.java:9: error: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.Keys;
[javac] 

有人可以告诉我发生了什么吗?^

4

2 回答 2

1

添加类路径引用,如下所示。

<javac includeantruntime="false" srcdir="./src" destdir="staging" 
classpathref="classpath" />
于 2013-06-10T10:57:22.847 回答
0

有人可以告诉我发生了什么吗?

包含相关类的 Jar 显然不在编译时类路径上。

于 2013-06-10T10:28:16.543 回答