我正在使用在Windows7的Cygwin上运行的bash shell。我在我的bash脚本中有这个,它试图根据当前执行的脚本…的位置来确定构建文件的位置
SCRIPT_DIR="$( cd -P "$( dirname "$0" )" && pwd )"
BUILDFILE=$SCRIPT_DIR/build.xml
ant -buildfile $BUILDFILE -Dbuildtarget=$1 -Dmodule="$2" -Dproject=$3 -Dnolabel=true -DFirefox=$4 -DInternetExplorer=$5 -DGoogleChrome=$6 Selenium4然而,即使文件在那里,我也得到了一个"Unable to locate buildfile error“
$ sh c:/selenium//run_client_tests.sh prod "\Critical Path\Live\QX" MyProj true false false
cygwin warning:
MS-DOS style path detected: c:/selenium//run_client_tests.sh
Preferred POSIX equivalent is: /cygdrive/c/selenium/run_client_tests.sh
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Started script
Buildfile: \cygdrive\c\selenium\build.xml does not exist!
Build failedls显示文件在那里…
dev@selenium_w7 /cygdrive/c/selenium
$ ls /cygdrive/c/selenium/build.xml
/cygdrive/c/selenium/build.xml
dev@selenium_w7 /cygdrive/c/selenium
$ ls c:/selenium/build.xml
c:/selenium/build.xml发布于 2011-12-05 10:51:58
这里的问题是ant不知道Cygwin风格的路径。注意,ant正在抱怨它找不到\cygdrive\c\selenium\build.xml。这是因为只有Cygwin shell才能理解/cygwin。
您需要做的是将DOS样式的路径传递给ant。所以替换掉
BUILDFILE=$SCRIPT_DIR/build.xml使用
BUILDFILE=`cygpath -w $SCRIPT_DIR/build.xml`或者,为了使其与平台更加无关,可以使用Java样式的路径
BUILDFILE=`cygpath -m $SCRIPT_DIR/build.xml`https://stackoverflow.com/questions/7516206
复制相似问题