所以我安装了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]
有人可以告诉我发生了什么事吗? ^
答案 0 :(得分:1)
添加classpath ref,如下所示。
<javac includeantruntime="false" srcdir="./src" destdir="staging"
classpathref="classpath" />
答案 1 :(得分:0)
有人可以告诉我发生了什么事吗?
包含相关类的Jar显然不在编译时类路径上。