问题
I want to include ANT, the JavaSDK and FlexSDK into my project directory. I need people in my company to be able to compile from source code.
I have a build.bat file which starts with :
ant blah/blah/blah
But what if I want to run ANT directly without the system environment variable? If I remove these from the system ant is not recognised
.
I am a real newbie here, but I want to do something like this:
start "${basedir}\libs\ant\bin" ant -lib ${basedir}/libs/ant/lib/flexTasks.jar
pause
This is so that other people dont need to install a whole load of software... IT would all be contained in the folder.
回答1:
Just set those environment variables in the same batchfile, i.e. something like :
set ANT_HOME=C:\ant182
set ANT_ARGS=-lib C:\antxtralibs
set JAVA_HOME=C:\jdk160_30
set PATH=%PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin
:: default
ant -f %1
:: debug
:: ant -debug -f %1
来源:https://stackoverflow.com/questions/9284244/how-can-i-run-ant-from-a-batch-file-without-having-an-environment-variable-set