title: Jenkins Build is giving error "workspace directory not valid"
body: <p>I am trying to run a ear task with ant on Jenkins. The ant task builds successfully on my local machine. </p>
  
  <p>However, when I try to build using Jenkins, I get the following error: "specified workspace is not valid". I tried hardcoding the workspace value, I tried getting it from the environment variables and I also tried to define it in a custom workspace and then accessing it. </p>
  
  <p>But I keep getting the following error:</p>
  
  <pre><code>[subProjEAR] $ cmd.exe /C '"F:\Build\Ant\apache-ant-1.8.4\bin\ant.bat &amp;&amp; exit       %%ERRORLEVEL%%"'
   Buildfile: E:\Jenkins\jobs\ProjectDev\workspace\subProjEAR\build.xml
  
  init.env:
  
  init.typedefs:
  Trying to override old definition of task apt
  
  init:
  
  BUILD FAILED
  
  E:\Jenkins\jobs\ProjDev\workspace\subProjEAR\build.xml:81: Specified workspace directory "E:\Jenkins\jobs\ProjDev\workspace" is not valid.
  
  Total time: 0 seconds
  Build step 'Invoke Ant' marked build as failure`
  </code></pre>
  
  <p>The code snipped around line 81 is as below</p>
  
  <pre><code>    &lt;target name="init" depends="init.env,init.typedefs" unless="init.executed"&gt;
      &lt;property name="init.executed" value="true" /&gt;
      &lt;fail unless="workspace" message="The workspace property needs to be set!" /&gt;
      &lt;dirname property="project.dir" file="${ant.file}" /&gt;
      &lt;property name="echo.metadata" value="false" /&gt;
  
      &lt;!-- Line below is no 81 --&gt;
      &lt;mdimport workspace="${workspace}" pjdir="${project.dir}" echo="${echo.metadata}"&gt; 
  
  
      &lt;/mdimport&gt;
      &lt;property name="archive.name" value="${project.name}.ear"/&gt;
      &lt;property name="uri" value=""/&gt;
      &lt;/target&gt;
  </code></pre>
  
  <p>I have created an environment variable named as WORKSPACE in my "local machine". Echoing prints it correctly ( C:\bea\user_projects\w4WP_workspaces\myProjWS).  I have also set the WORKSPACE environment variable on the Jenkins machine. This is the same workspace as Jenkins. Echo on Jenkins prints the below:</p>
  
  <pre><code>Buildfile: E:\Jenkins\jobs\ProjectDev\workspace\subProjEAR\build.xml
  
  init.env:
  
  init.typedefs:
  Trying to override old definition of task apt
  
  init:
       [echo] workspace : E:\Jenkins\jobs\ProjectDev\workspace 
       [echo] weblogic workspace : ${env.WORKSHOP_WORKSPACE}
  
  
  BUILD FAILED
  E:\Jenkins\jobs\ProjectDev\workspace\subProjEAR\build.xml:85: Specified workspace directory "E:\Jenkins\jobs\ProjectDev\workspace" is not valid.
  </code></pre>
  
  <p>Please help.</p>