I am trying to run a ear task with ant on Jenkins. The ant task builds successfully on my local machine.
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.
But I keep getting the following error:
[subProjEAR] $ cmd.exe /C '"F:\Build\Ant\apache-ant-1.8.4\bin\ant.bat && 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`
The code snipped around line 81 is as below
<target name="init" depends="init.env,init.typedefs" unless="init.executed">
<property name="init.executed" value="true" />
<fail unless="workspace" message="The workspace property needs to be set!" />
<dirname property="project.dir" file="${ant.file}" />
<property name="echo.metadata" value="false" />
<!-- Line below is no 81 -->
<mdimport workspace="${workspace}" pjdir="${project.dir}" echo="${echo.metadata}">
</mdimport>
<property name="archive.name" value="${project.name}.ear"/>
<property name="uri" value=""/>
</target>
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:
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.
Please help.