在批处理文件中设置ants路径

时间:2012-08-23 05:24:54

标签: ant batch-file

我有一个批处理文件,其中我将ant路径和junit路径值设置为硬编码,并执行我的build.xml,一切正常。

当我用路径替换路径的硬编码值时 set Path=%CURRENT DIRECTORY%\bin
它不起作用。

如何使这项工作。

这是我的批处理文件

set CURRENT_DIRECTORY=%~dp0

set ANT_HOME=c:\ant\apache-ant-1.8.3
ECHO current directory is %CURRENT_DIRECTORY%
ECHO %ANT_HOME%
set Path=%ANT_HOME%\bin
set ADAPTER_LIBRAY_PATH=%1
set USER_JAR_PATH=%2
set CLASS_NAME=%3
set RESULTS_PATH=%4
set JUNIT_PATH=C:\ANT\test\junit-4.1.jar
set LIBRAIES_TO_INCLUDE="%JUNIT_PATH%";"%ADAPTER_LIBRAY_PATH%";"%USER_JAR_PATH%"
ECHO %LIBRAIES_TO_INCLUDE%
ECHO %ADAPTER_LIBRAY_PATH%
ECHO %JUNIT_PATH%
ECHO %USER_JAR_PATH%
ECHO %CLASS_NAME%
ECHO %RESULTS_PATH% 

ant -lib "%LIBRAIES_TO_INCLUDE%" -Dlibraries="%ADAPTER_LIBRAY_PATH%" -Djunitlibrary="%JUNIT_PATH%" -Djartobeexec="%USER_JAR_PATH%" -Duserclass=%CLASS_NAME% -Dresultspath=%RESULTS_PATH% -buildfile build.xml test-html

1 个答案:

答案 0 :(得分:2)

试试这个:

SET ANT_HOME = ant_directory “%JAVA_HOME%\ bin \ java”-Xmx512M -XX:MaxPermSize = 256M -cp%ANT_HOME%/ lib / ant-launcher.jar -Dant.home =“%ANT_HOME%” - Dant.library.dir =“%ANT_HOME %/ lib“org.apache.tools.ant.launch.Launcher -f build.xml%*