I wanted to bring the code into Eclipse, but not as one giant million-line project. Instead, I wanted to break it up into smaller projects.
But there were complications:
- The source tree has a single root directory
- Eclipse can't nest projects
- Some source files used throughout the code are located in the top of the source tree
- Packages and layers have mutual dependencies (for example, business logic in the UI layer), but Eclipse treats cycles among projects as compile errors
- JAXB is used to generate some .class files into a runtime directory "rt", but that same directory contains all of the .class files for the system
- None of this can be changed, at least not any time soon
Fortunately, Eclipse supports linked source, so I created the Eclipse projects in a different location, and set their build paths to have linked-source entries that pointed to the source tree.
The first step is to create a global linked-resource variable that points to the root of the source tree:
Then right-click on each project and select Build Path → Configure Build Path... → Link Source... → Variables..., and select the global linked-resource variable.
Saving the changes results in a .classpath entry like this:
<classpathentry kind="src" path="src"/>and a .project entry like this:
<linkedResources>for each project.
(Because I had so many projects to manage, I edited the .project files directly, instead of interactively.)
Unfortunately, item #1 complicated linking to the source, because every Eclipse project linked to the same root directory, which meant every Eclipse project saw the same source instead of just seeing the source for that project.
For example, if the source tree looks like:
This modifies the .classpath files to have entries like:
<classpathentry kind="src" path="src"
Unfortunately, once everything was configured and I launched Eclipse, it took 35 minutes to load.
It turned out that Eclipse bogs down if it has to import a lot of source code and then filter it out. Ideally it would filter it out first and only load the remainder, but it doesn't seem to do that.
After reporting this problem