ant脚本中的工作目录错误 - classpathref的build.xml

时间:2011-10-29 12:10:31

标签: ant path build.xml

我有一个构建文件,其中有一个如下任务

// tomcat stop ant script
                                                                              

When I run **tomcat-stop** task, instead of picking up the lib folder from tomcat server, it is trying to take my working directory.

I have set the project basedir as basedir=".". All my other tasks in the build file are working as expected but only in this scenario (tomcat-stop) I am finding an issue.

Error:

**C:\Dev\WebDev\XYZ\build.xml:103: C:\Dev\WebDev\XYZ\${build.tomcat.dir}\lib does not exist.**

I am using property file and everything from the property file is taken as expected. Also in the build.xml when I hover my mouse at the **classpathref="tomcat.class.path"**, it is showing all the files from tomcat lib but when I run the task I am getting the above error.

Entry in property file:
build.tomcat.dir=C:/TomcatServer

Any help is appreciated.

Thanks,

1 个答案:

答案 0 :(得分:0)

看起来您的属性文件已加载到“clean”目标中。如果您只是自己调用'tomcat-stop'目标,则永远不会加载属性文件。你的其他目标正在发挥作用,因为它们依赖于“干净”。

尝试移动加载属性文件的行,使其成为根元素的直接子元素。即没有嵌套在目标内。