title: How to set Ant properties based on variables in Eclipse?
body: <p>I have a common problem and there are probably countless ways to solve it.  I'm looking for an elegant, simple solution to this typical scenario:</p>
  
  <p>I have a project in Eclipse with an Ant build file (build.xml) the build file uses a property file (build.properties). In that property file, I want to set a property that points to the root directory of the eclipse project such as:</p>
  
  <pre><code>project.root = /path/to/eclipse/workspace/projectName
  </code></pre>
  
  <p>or preferably:</p>
  
  <pre><code>project.root = ${path.to.eclipse.workspace}/projectName
  </code></pre>
  
  <p>How do I do this in such a way that:</p>
  
  <ol>
  <li>Works on different machines with different paths to the project root (i.e. in a team environment)</li>
  <li>Allows the ant build.xml file to be executed inside eclipse</li>
  <li>Allows the ant build.xml file to be executed outside of eclipse (i.e. from command line)</li>
  <li>Allows the build.properties file to exist in a directory other than the project root</li>
  </ol>