Jenkins配置ant依赖问题

使用Jenkins集成ant构建Android项目遇到的问题:
cmd.exe /C “ant.bat release && exit %%ERRORLEVEL%%”
原因为Jekins配置ant依赖错误,解决方案如下(来自stackoverflow):
1.In windows:

ANT_HOME environment variable should be set to your ant install dir. If you haven’t such, download ant and unzip it.

第一步,在windows中设置ANT_HOME环境变量为ant安装目录

2.In Jenkins configuration

%ANT_HOME%\bin should be added to PATH
Go to Jenkins / Manage Jenkins / Configure System / Ant Installation.
Uncheck Install Automatically
Give name for Ant (AntName)
Put ant install dir into ANT_HOME
第二步:
1.将%ANT_HOME%加入环境变量
2.进入Jenkins-> 系统管理->Global Tool Configuration->设置Ant
3.反选自动安装,设置ant名称,将ant路径加入ANT_HOME

3.In Jenkins project

Got to Project/Configure/Build/Invoke Ant. (Add Build Step/Invoke Ant if you haven’t any). In Ant Version change Default to AntName (set by you in the Jenkins configuration)
第三步,进入自己配置的项目->配置->构建->invoke ant,将ant版本设置为第二步中设定的ant名称

你可能感兴趣的:(Jenkins配置ant依赖问题)