How do i configure ANT on my jenkins slave

2,153 views
Skip to first unread message

Eric Wood

unread,
Feb 6, 2014, 3:47:05 PM2/6/14
to jenkins...@googlegroups.com
I have set up a new slave and it needs to run ANT.  I have downloaded and installed.  Set ANT_HOME and the PATH.  I can run from the cmd prompt.  I stopped the Jenkins java process and restarted it on the slave, but when I run the job I keep getting:

$ cmd.exe /C '"ant.bat -file build.xml -Dcopy-dir.src.dir=C:\Jenkins\workspace\hp-test	estSuiteSanityTest_RM -Dcopy-dir.target.dir=C:JenkinsHP-TestRMV4.4SanityTest_RM copy-dir && exit %%ERRORLEVEL%%"'
'ant.bat' is not recognized as an internal or external command,

What is the proper way to configure?

Thanks,
 Eric

Mark Waite

unread,
Feb 6, 2014, 4:11:53 PM2/6/14
to jenkins...@googlegroups.com
The easiest way with Ant is to use the Jenkins global configuration to configure an Ant installation, and have it download that Ant installation from Apache.  Then you define the job to use the specific Ant version you configured, and it will be downloaded and used for that build.

That keeps your life simpler when you add and remove slave nodes, since you don't need to take extra steps to install and configure Ant on each slave.  Jenkins does it for you because you configured Ant in the Jenkins configuration page.

Mark Waite


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks!
Mark Waite

Les Mikesell

unread,
Feb 6, 2014, 4:15:42 PM2/6/14
to jenkinsci-users
On Thu, Feb 6, 2014 at 3:11 PM, Mark Waite <mark.ea...@gmail.com> wrote:
> The easiest way with Ant is to use the Jenkins global configuration to
> configure an Ant installation, and have it download that Ant installation
> from Apache. Then you define the job to use the specific Ant version you
> configured, and it will be downloaded and used for that build.
>
> That keeps your life simpler when you add and remove slave nodes, since you
> don't need to take extra steps to install and configure Ant on each slave.
> Jenkins does it for you because you configured Ant in the Jenkins
> configuration page.
>

Or, if you want to install it yourself you can give the version a name
in the global config, then in the per-node config, in node properties,
tool locations, add a path to find it on that node.

--
Les Mikesell
lesmi...@gmail.com

Baptiste Mathus

unread,
Feb 7, 2014, 12:30:30 PM2/7/14
to jenkins...@googlegroups.com

But, I'll add, better don't do it.

Let Jenkins install ant by himself on the slaves. It will really make your life simpler. If the public ant versions don't suit your needs, you can even just package the one you need, upload it somewhere in your company and tell Jenkins to install this version instead of the plugin one.

(This message is sent from the guy who didn't do it originally...  And infra eventually became unmanageable when growing, until we finally switch to this mode afterwards :))

Eric Wood

unread,
Feb 7, 2014, 1:00:34 PM2/7/14
to jenkins...@googlegroups.com
I did switch and let Jenkins configure it and it does work great.  The issue I have now is that when I run the build.xml through Jenkins on the slave,  it does not read the properties from the environment using:

<property environment="env"/>

If I run it manually from a cmd windows on the server it does. Seems to be the way the slave handles system variables. Does it suppress them somehow or do I need to change my ANT code to read it as a normal property inherited from the Master?

Thanks, Eric

Les Mikesell

unread,
Feb 7, 2014, 1:52:31 PM2/7/14
to jenkinsci-users
On Fri, Feb 7, 2014 at 11:30 AM, Baptiste Mathus <bma...@batmat.net> wrote:
> But, I'll add, better don't do it.
>
> Let Jenkins install ant by himself on the slaves. It will really make your
> life simpler. If the public ant versions don't suit your needs, you can even
> just package the one you need, upload it somewhere in your company and tell
> Jenkins to install this version instead of the plugin one.
>
> (This message is sent from the guy who didn't do it originally... And infra
> eventually became unmanageable when growing, until we finally switch to this
> mode afterwards :))
>

I sort-of manage it by installing versions on a shared drive that all
the slaves see - windows slaves use UNC paths and linux slaves have an
nfs mount in a common location. So there is some extra work, but
not a full install on every target.

--
Les Mikesell
lesmi...@gmail.com
Reply all
Reply to author
Forward
0 new messages