I have an ant script with the following header:
<project name="Simple ActiveJDBC Example" default="clean" basedir=".">
And then somewhere below:
<target name="compile" depends="clean">
<javac srcdir="src" destdir="${classes}" debug="on" optimize="off" deprecation="off" includeantruntime="false">
<classpath refid="compile_classpath"/>
</javac>
</target>
Eclipse it seems searches for the src
directory in the 'wrong' location! Since this script works perfectly fine when running the ant build from the command prompt. I am no ant expert but this thing is just driving me nuts :) Any ideas? Here's the error that I get for the above code where src
is specified:
C:\Users\Nupul\Documents\MyProject\ActiveJDBC\ant-example\build.xml:50:
srcdir "C:\Users\Nupul\workspace\Simple ActiveJDBC Example\src" does not exist!
As you can see the build.xml file is located in the upper path but eclipse seems to somehow search in the workspace directory and that too with the project name
in the xml file and NOT in the directory where it's located!! I have absolutely no idea how to override this behavior.
All paths are correctly handled in the xml (as observed if you hover over the <pathelement>
elements). However, I have no idea why this works from the command prompt but fails in eclipse.
The Ant Builder options for eclipse is configured to 'run in the same JRE as the workspace' but not sure if that's the culprit.
Even if I change the it to src = ${basedir}/src
I get the same error for files referred in the 'other' path element tags!
Any ideas?
PS: I'm trying to compile the simple-ant example for the ActiveJDBC project - but via eclipse :)
Found it - seems when you Right Click > Properties > Builders > "Your ant builder" and then click Edit you'll get variables as ${workspace_loc} in the path of the ant file and base directory - this will happen if you chose to 'browse' for these files from the 'workspace' instead of 'file system'
If the project is created in/by the workspace, go with the former else if it's imported make sure your files are selected from the 'file system'