I am using Jenkins as CI. I have an build.xml. Build.xml
has code like below.
<property name="environment" value="$environment}" />
How can i pass value to build.xml from Jenkins ? Can i pass it through environment variables?
Your environment variables are available via the environment property. In the example below, the environment variable VIEW is printed from the simple hello world ant script via ${env.VIEW}. Change VIEW to the name of the environment variable of interest.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Hello World" default="Hello" basedir=".">
<property environment="env"/>
<property name="HelloText" value="Hello"/>
<target name="Hello">
<echo>VIEW=${env.VIEW}</echo>
</target>
</project>
IMPORTANT! Note that this line is needed in order for env.VIEW
to be understood by ant:
<property environment="env"/>