title: Integrate Ant builder into Eclipse: Error "Variable references empty selection"
body: <p>I have some Ant tasks in my Eclipse JDT project that I want to execute before each compilation, so I added an Ant builder to my Eclipse builder config. As the location of the build file, I entered</p>
  
  <pre><code>${workspace_loc:${project_path}/build.xml}
  </code></pre>
  
  <p>I do <em>not</em> want to have any absolute paths, or the project name, here. The Eclipse configuration is part of the repository, and other users check this out with different file-system layouts and possibly different Eclipse project names. For example, I usually have several working copies of the same project in my Eclipse workspace, each of course with a different project name.</p>
  
  <p>This works most of the time. However, I sometimes get the following error message in a dialog box:</p>
  
  <blockquote>
    <p>Errors occurred during the build.<br>
    Errors running builder 'Integrated External Tool Builder' on project 'MyProjectName'.<br>
    Variable references empty selection: ${project_path}<br>
    Variable references empty selection: ${project_path}</p>
  </blockquote>
  
  <p>This seems to happen when Eclipse decides to build the project while no resource of the project is selected in the Package Explorer. I can reproduce it by creating a dummy file in the project, deleting the file outside of Eclipse, selecting it in Eclipse and pressing <kbd>F5</kbd>. Eclipse will note that the file no longer exists, remove it from the Package Explorer (so nothing is selected anymore) and then build the project, giving the error message.</p>
  
  <p>While it's not really that important that the Ant tasks are run for every compilation, I do not want to have such an error message box which will confuse users.</p>
  
  <p>So how can I</p>
  
  <ul>
  <li>reference the build.xml file in a different way such that the problem goes away, or</li>
  <li>fix the problem, or</li>
  <li>suppress the error dialog for this particular error?</li>
  </ul>
  
  <p>Any help would be appreciated. I'm using Eclipse 3.7 (Indigo).</p>