Community
Participate
Working Groups
After importing a project from build.xml, build using ant, as described below, and get an error pointing to missing files from a directory inside the workspace. I think the working directory for ant should be set to the project directory, not anywhere inside the workspace. Here are some steps to reproduce the problem. Outside Eclipse: mkdir testproject mkdir testproject/src cd testproject vi src/Main.java enter: class Main { public static void main(String[] args) { System.out.println("Hello World"); } } vi build.xml enter: <project name="Test" default="main"> <target name="main"> <mkdir dir="build"/> <javac destdir="build"> <src path="src"/> </javac> </target> </project> ant You should see: Buildfile: build.xml main: [mkdir] Created dir: /directory/testproject/build [javac] Compiling 1 source file to /directory/testproject/build BUILD SUCCESSFUL Total time: 2 seconds In Eclipse: Go to File->New->Project. Select "Java Project from Existing Ant Buildfile". Select build.xml in the textfield "Ant Buildfile". Click Finish. Double-click on build.xml in the Navigator View. Right-click on the target 'main' in the Outline View (default: right hand side). Select Run As->1. Ant Build. Output: Buildfile: /directory/.eclipse_workspace/Test/build.xml main: BUILD FAILED /directory/.eclipse_workspace/Test/build.xml:4: srcdir "/directory/.eclipse_workspace/Test/src" does not exist! Total time: 345 milliseconds
I fixed the immediate symptom by setting a base directory for the build.xml: Right-click on build.xml, Run As, External Tools... Select the Base Directory in that dialog. However, the other files that Eclipse doesn't know or care about from my project directory don't appear. For example, my 'unittests' task outputs unittest_output and unittest_error, which I cannot see inside Eclipse, because Eclipse is looking at /directory/.workspace/Test instead of /directory/Test.
This will be solved with the fix to allow the buildfile to be linked to the original location in the filesystem instead of being imported into the workspace. *** This bug has been marked as a duplicate of bug 147337 ***