title: How to determine Jenkins build directory from Ant?
body: <p>I am trying to migrate an Ant script I wrote to build and deploy projects from within the Jenkins framework (instead of triggered from an SVN post-commit hook, which was the expedient way we initially approached things). Everything is great, except I need to stage files for the deploy step and I want to stuff them into the 'build' directory Jenkins creates for the job (and since my build.xml lives in a non-project-specific location, ${basedir} and ${user.dir} do not point to the desired location).</p>
  
  <p>within the Jenkins configuration, I've setup the following:</p>
  
  <p>[Jenkins]
  Build Record Root Directory: E:/builds/${ITEM_FULLNAME}</p>
  
  <p>[Job-Specific]
  Build File: C:\vc-tools\shadow\build.xml</p>
  
  <p>when running a build, the script is appropriately launched and a job-specific build directory is created, e.g.</p>
  
  <p>E:\builds\Test\2012-08-07_12-51-21</p>
  
  <p>I want to get at this directory from within the build script, but cannot figure out how. some of the things I've tried:</p>
  
  <pre><code> [echo] ${basedir}: C:\vc-tools\shadow
   [echo] ${user.dir}: C:\vc-tools
   [echo] ${env.workspace}: C:\Program Files (x86)\Jenkins\workspace\Test
   [echo] ${env.build_id}: 2012-08-07_12-51-21
   [echo] ${jenkins_home}: C:\Program Files (x86)\Jenkins
   [echo] ${BuildDir}: E:/builds/${ITEM_FULLNAME}
  </code></pre>
  
  <p>note: for that last one, I tried passing in:</p>
  
  <pre><code> BuildDir=E:/builds/${ITEM_FULLNAME}
  </code></pre>
  
  <p>as a property configured from the job within Jenkins (clearly ${} expansion doesn't take place in this context).</p>
  
  <p>according to the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables">documentation</a>, there are no specific environment variables that are set to the full build directory path -- I can fudge it by hardcoding the E:\builds root and tacking on ${env.build_id}, but was hoping there would be an easier way to access the complete path from something Jenkins exposes (either an Ant property and an environment variable) in order to make the script more flexible.</p>
  
  <p>I am using Jenkins version 1.476.</p>
  
  <p>thanks</p>