Today, I'll describe how we solved a similar problem with our runtime classes:
5. 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
Some details on the situation:
- Our project currently uses gmake to compile the million-plus lines of code.
- Builds output to a runtime directory on the developer's machine called "rt". All classes required to launch the application are either in rt, or in JARs in a "lib" directory.
- Many of the classes in the rt directory are duplicates of classes Eclipse compiles in the projects, but some of the classes in the rt directory are generated by JAXB (which is executed by gmake as part of the builds), and are not in the source tree.
- Eclipse needs to see the generated classes in order to compile.
package com.parent.child1;Eclipse supports linked resources, so at first it seemed like we just needed to define a linked resource for external classes that pointed to rt. Unfortunately, there are so many classes in rt that Eclipse again ground to a halt.
public class Child1 extends Parent
private Gen1 gen1;
Fortunately, by now we were experienced with using links to subset a source directory hierarchy, so I just used the same approach to subset the runtime directory hierarchy.
First, run commands to add a link into the rt directory at the desired location:
junction C:\projects\Child1\rt\com\parent\child1\generated C:\rt\com\parent\child1\generated
Then add the rt directory to the .classpath:
<classpathentry kind="lib" path="rt"/>Refresh in Eclipse, and the code builds:
- As was the case with source files, multiple links to runtime-class directories can be created for a single project.
- If multiple projects need the same .class files from an rt directory, the rt link should be set only in the project that generates the .class files. Other projects should point to that rt link via Build Path → Add Class Folder...
In Part V, I'll describe how we fixed a problem with the Perforce Eclipse plugin caused by using links.