Correcting cyclical dependencies after an EAR is imported
You can resolve cyclical dependencies after an EAR is imported.
A cyclical dependency between two or more modules in an enterprise application most commonly occurs when projects are imported from outside the workbench. When a cycle exists between two or more modules in an enterprise application, the Java builder cannot accurately compute the build order of the projects. Full builds fail under these conditions, or require several invocations.
Therefore, the best practice is to organize your projects or modules into components. This allows your module dependencies to function as a tree instead of a cycle diagram. This practice has the added benefit of producing a better factored and layered application.
- Identify all the classes within the JAR files that have cyclical dependencies, then move those classes into a common Java project or JAR file.
- Use the enterprise application editor to map utility JAR files to the common projects.
- Use the JAR dependency editor or properties page, for each module of the JAR in the application, to set dependencies only to the JAR files that are truly required.
Related concepts
Cyclical dependencies between J2EE modules
Related tasks
Importing an enterprise application EAR file
Specifying dependent JAR files or modules