Reputation: 3
I am passing on environment variable JOB_NAME
to maven build from jenkins
as below
-DJOB_NAME=${JOB_NAME}
in build step
I am using that JOB_NAME value for referencing the folders under that particular project folder on Jenkins server. But value of this variable is null.
Could you help me out to get proper value.
Upvotes: 0
Views: 2085
Reputation: 905
you have to set the environment handle as "env" in any external build tools you might use as Jenkins vars are not passed to the build tool automatically, for example in Ant scripts you have to set the below line before using Jenkins variables
<property environment="env"/>
This lets Ant know that any variable followed by env. might be available from the host thats executing the Ant build and in this case being Jenkins.
Upvotes: 1