How to automatically add projects to Eclipse PDT build/include path for code completion?

169 views Asked by At

I used Eclipse PDT (Kepler with PDT 3.2.0) as my main IDE and there is something I could find how to do.

I'm working on a big Zend application, with a couple of hundreds of modules on it. To make it easier to code, I add to Eclipse each of these modules as a separate project. They are also logically arranged on Working Sets.

I would like to make it so that the classes of all of the open projects on the workspace appear as code completion automatically on the other projects. Right now it only recognizes the classes on that same module, or I have to create a library based on the local folder and manually add to each project, which makes building very slow.

1

There are 1 answers

0
Tobber On

I am not aware of a setting that can solve this, but there is some other options.

You can add the bin folder for each project to the build path: Project preferences -> Java Build Path -> Libraries -> Add Class Folder. This is a painstakingly slow process to do through the gui, so you might want to add the line <classpathentry kind="lib" path="/NAME_OF_PROJECT/bin"/> to the .classpath file - one line for each project - and work some copy-paste.

If you add new modules relatively often, you might want to automatize this. You could of-course write some hack-script that modifies the .classpath file, but a more proper way will be to create your own classpath container. Take a look at this blog post, that describes how to create one. You should be able to get it working in less than a day, if you have experience with Plugin development.