I have some Ant tasks in my Eclipse JDT project that I want to execute before each compilation, so I added an Ant builder to my Eclipse builder config. As the location of the build file, I entered
${workspace_loc:${project_path}/build.xml}
I do not want to have any absolute paths, or the project name, here. The Eclipse configuration is part of the repository, and other users check this out with different file-system layouts and possibly different Eclipse project names. For example, I usually have several working copies of the same project in my Eclipse workspace, each of course with a different project name.
This works most of the time. However, I sometimes get the following error message in a dialog box:
Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'MyProjectName'.
Variable references empty selection: ${project_path}
Variable references empty selection: ${project_path}
This seems to happen when Eclipse decides to build the project while no resource of the project is selected in the Package Explorer. I can reproduce it by creating a dummy file in the project, deleting the file outside of Eclipse, selecting it in Eclipse and pressing F5. Eclipse will note that the file no longer exists, remove it from the Package Explorer (so nothing is selected anymore) and then build the project, giving the error message.
While it's not really that important that the Ant tasks are run for every compilation, I do not want to have such an error message box which will confuse users.
So how can I
Any help would be appreciated. I'm using Eclipse 3.7 (Indigo).
Obviously, it has problems translating a reference to a variable (${project_path}) inside ... a reference to a variable (${workspace_loc}).
You could try the ${build_project} variable instead
${build_project:/build.xml}
I hope it helps.
You suffered some inconvenience in the Eclipse's UI. The logic dictates you that when you have opened a project, the variables regarding the opened project should be populated. But they're not, because due to a bug or other reason, the code killed them after the focus moved elsewhere.
So as a workaround you can:
Clicking on the project (folder icon) will populate the variables
By the way, I think ${workspace_loc}${project_path}/build.xml
is ok.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With