简体   繁体   English

Jenkins + Ant构建错误

[英]Jenkins + Ant build error

[Project1] $ cmd.exe /C '"ant.bat && exit %%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,
operable program or batch file.
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

I already set env variables ANT_HOME, JAVA_HOME and PATH variables. 我已经设置了env变量ANT_HOME,JAVA_HOME和PATH变量。 But still i am getting above error. 但我仍然犯了错误。

I am using windows 8 OS. 我正在使用Windows 8操作系统。

You could go to Jenkins global configuration (Manage Jenkins => Configure system) and add an Ant installation and check the box "Install automatically". 您可以转到Jenkins全局配置(Manage Jenkins => Configure system)并添加Ant安装并选中“自动安装”复选框。

In your job you could then use the Ant built step. 在您的工作中,您可以使用Ant构建的步骤。

This way Jenkins downloads Ant, installs it into its private tool directory and calls it from there. 这样Jenkins就会下载Ant,将其安装到其私有工具目录中并从那里调用它。

You probably have this solved by now but I'm going to share my answer to this problem anyway. 你现在可能已经解决了这个问题,但无论如何我都会分享我对这个问题的答案。 It might help others in the future. 它可能在将来帮助其他人。 I've had this EXACT problem (my jenkins was a remote server) and I solved it by creating the node on server again and downloading the slave one more time. 我有这个问题(我的jenkins是一个远程服务器),我通过再次在服务器上创建节点并再次下载奴隶来解决它。 But I had to do this FROM THE CLIENT'S machine. 但我不得不从客户的机器上做到这一点。 For some reason, jenkins was getting information from the machine I was creating the nodes and using it as the path. 出于某种原因,jenkins从我正在创建节点的机器获取信息并将其用作路径。 So yeah, thats the solution. 所以,是的,这就是解决方案。 Crate your node again from the client's machine. 再次从客户端的计算机中创建节点。

转到Jenkins =>管理Jenkins =>全局工具配置并添加Ant安装并选中“自动安装”框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM