How do i pass parameters from Jenkins to Ant scripts?

user1402561 picture user1402561 · May 18, 2012 · Viewed 29.3k times · Source

For some GUI testing I'm creating a Jenkins task for each GUI module to be tested. Once created I'm using Ant to build these tests, but I'm not aware of how to actually pass parameters from Jenkins to Ant build file? Basically how do I do variable substitution in Ant?

I'm using the Sahi framework to test GUI components, so the flow goes like this...

Jenkins → Ant build script → Sahi file to execute

Can anyone please take a look at it?

Answer

Tyler Smith picture Tyler Smith · May 18, 2012

"Using ant -Dname=value lets you define values for properties on the Ant command line." http://ant.apache.org/faq.html#passing-cli-args

To use a jenkins parameter as a variable when you call any use ${variablename}

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build