在eclipse / junit中使用ANT Build运行build.xml时出错

时间:2015-04-17 09:35:01

标签: java eclipse selenium ant junit

我是webdriver的新手,我只想执行我的脚本并使用selenium / Junit中的ANT Build生成测试结果。当我尝试运行脚本时,我收到以下错误:

  

$ {ECLIPSE_HOME} \ plugins不存在。

我该如何解决这个问题?

Buildfile: C:\Users\xxx\workspace\Script\build.xml
build-subprojects:
init:
build-project:
     [echo] Script: C:\Users\xxx\workspace\Script\build.xml
build:
clean:
   [delete] Deleting directory C:\Users\xxx\workspace\Script\bin
cleanall:
clean:
init:
    [mkdir] Created dir: C:\Users\xxx\workspace\Script\bin
build-subprojects:
init:
build-project:
     [echo] Script: C:\Users\xxxx\workspace\Script\build.xml
    [javac] Compiling 4 source files to C:\Users\xxx\workspace\Script\bin
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning
build-refprojects:
init-eclipse-compiler:

BUILD FAILED
C:\Users\xxxx\workspace\Script\build.xml:43: C:\Users\xxxx\workspace\Script\${ECLIPSE_HOME}\plugins does not exist.

Total time: 1 second

1 个答案:

答案 0 :(得分:3)

{ECLIPSE_HOME}是ant正在查找但尚未定义的属性。您可以在build.xml的顶部定义此属性:

<property
    name="ECLIPSE_HOME"
    location="C:\Program Files\eclipse" />

或者您可以在环境变量

下将属性添加到PATH

或者,如果您的build.xml引用了project.properties或ant.properties文件,您可以添加以下行:

ECLIPSE_HOME=C:\Program Files\eclipse

请注意“C:\ Program Files \ eclipse”只是一个示例,将您的真实目录路径放在您机器上的Eclipse中。