Question

I have a project with an Ant build script that creates a JAR file based on CLASS files in a separate Dynamic Web Project. I've read that I can use ${workspace_loc} in my build script, but when I replace the hard-coded path to the Dynamic Web Project with ${workspace_loc}, the build fails with:

BUILD FAILED D:\Eclipse\projects\webapp\workspace\Ant build for client\build.xml:30: D:\Eclipse\projects\webapp\workspace\Ant build for client\${workspace_loc}\otherproject\build\classes does not exist.

I can't use ${basedir} because the build project is in a separate project than the build project.

How do I get Ant in Eclipse to recognize the Eclipse workspace_loc variable?

Was it helpful?

Solution

You can do the following:

<path id="workspacePath" location=".." />

<pathconvert property="workspace" refid="workspacePath"/>

<property name="otherProject" value="${workspace}/otherProjet" />

<echo>The other project path is ${otherProject} </echo>

The path workspace should return the parent of ${basedir}. If you did not set this value, ${basedir} is set to "." (the directory of the build.xml). If you did set the ${basedir} to a different value, then you will need to adjust the value of location attribute.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top