gpt4 book ai didi

java - 无法使用 ant build.xml 文件构建 webdriver java 代码

转载 作者:行者123 更新时间:2023-12-01 14:28:12 24 4
gpt4 key购买 nike

所以我安装了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]

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

最佳答案

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

<javac includeantruntime="false" srcdir="./src" destdir="staging" 
classpathref="classpath" />

关于java - 无法使用 ant build.xml 文件构建 webdriver java 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17021700/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com