简体   繁体   中英

Jenkins: Windows slave, linux master, how to configure (ant) build tools properly?

I have a jenkins 1.5XX master node running on centos/linux that builds java stuff with maven and ant. It works perfectly for a long time.

Now I want to add a Windows slave to build C++ windows programs and stuff. They were previously built on a separate jenkins server but it died and I lost everything.

I created a windows VM and managed to setup a slave node on the vm with the doc provided in the jenkins wiki . The node/jenkins windows service works.

I created a Job to be runned on the windows slave and tied it to the slave via the config. It works since I see Building remotely on bld2-windows in workspace C:\\Software\\Jenkins\\workspace\\mgmt .

My Ant installations are defined in the global properties and are working and existing on the linux node.

In the windows node config I defined "Tool Locations" for the Ant installation and targeted a valid Ant install on the windows xp server: "Home = C:\\Software\\Liberty\\ant"

Although, it crashes after the checkout with the error msg: FATAL: Cannot find executable from the chosen Ant installation

The problem was that the path and ANT_HOME were not properly configured on the windows node. in order to fix this, in windows, go to "My Computer" > "Properties" > "Advanced" > "Environment Variables" and define ANT_HOME .

To test ant install on windows, I suggest you open a cmd prompt and type ant.bat if it opens ant, you are good.

On the jenkins node setup, no need to define any tools location or override anything. Just use ant default in the job config.

I have found that the setup needs to be completed at the node config in order to properly pick up ant, java etc. With these settings properly configured, my builds run fine on the slave.

host:8080/computer/[NODENAME]/configure

Node properties:

  • List of key-value pairs

     name: ANT_HOME value: [Path to ant root] name: JAVA_HOME value: [Path to java (jdk) root] name:PATH value:%PATH%;[Path to ant root]\\bin 
  • Tool Locations

     Name:(Ant) 1.9.4 Home:[Path to ant root] Name:(JDK) 1.7.0_25 Home:[Path to java (jdk) root] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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