title: Access Jenkins Environment Variables in Java Program
body: <p>Is there any way to access jenkins environment variables (BUILD_NUMBER etc)in a java program without doing any changes in jenkins job.</p>
  
  <p>I am thinking if there is any listener (Jenkins or Maven) that I can hook into for getting jenkins enviroment variables and then I can set them as <strong>System</strong> properties and access anywhere in my java program.</p>
  
  <p>I came across <strong>EnvInject</strong> plugin but that would require job changes. I am looking for a solution where I can get access programmatically!! </p>
  
  <p>Ref:
  <a href="https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables" rel="nofollow noreferrer">https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables</a></p>