如何在没有设置环境变量的情况下从批处理文件运行 ANT? [英] How can I run ANT from a batch file without having an Environment Variable set?

查看:36
本文介绍了如何在没有设置环境变量的情况下从批处理文件运行 ANT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 ANT、JavaSDK 和 FlexSDK 包含到我的项目目录中.我需要我公司的人能够从源代码编译.

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.

我有一个以 :

ant blah/blah/blah

但是如果我想在没有系统环境变量的情况下直接运行ANT怎么办?如果我从系统中删除这些ant 不被识别.

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

这样其他人就不需要安装一大堆软件了...... IT 将全部包含在文件夹中.

This is so that other people dont need to install a whole load of software... IT would all be contained in the folder.

推荐答案

只需在同一个批处理文件中设置这些环境变量,例如:

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

这篇关于如何在没有设置环境变量的情况下从批处理文件运行 ANT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆