You can create links to sources that are outside the project, thereby saving you from copying the sources into the project, and enabling to share resources with others. Linking to COBOL copybooks or copybook projects can be useful, particularly if the copybooks are used by multiple projects.
When a project uses sources from another project or build artifacts generated by another project, the project that contains the sources or generates the artifacts is referred to as a project dependency of the project that uses them.
COBOL projects can depend on other COBOL projects. Java projects can depend on Java and JVM COBOL projects. JVM COBOL projects can depend on JVM COBOL and Java projects.
There are two main types of project dependencies.
When you add a dependant project (Project B) all its copybook paths are added to the copybook paths of the project (Project A) and thus allows using any copybook from Project B in Project A.
An example of build artifact dependency is when an .exe file from Project A loads a .dll from Project B at run time or when an .exe file from Project A links statically a .dll from Project B.
Regardless of the dependency type, the build order of the projects changes automatically to ensure that dependent projects will be built first. Thus when Project B is a dependency of Project A, Project B is built first. This is needed to ensure that the build artifacts of Project B are up-to-date before Project A uses them.
To check the build order open Window > Preferences > General > Workspace > Build Order.
You can link to individual source files and to folders containing sources. You can specify absolute paths to the sources. Alternatively, you can use a variable to define a path and then you can link to sources using a relative path. Linked resources like these show in the project in the COBOL Explorer as file icons decorated with a square with an arrow link.
In addition, you can create a copybook project or remote copybook project, and link to the project rather than individual copybooks it contains.
You can define the order in which folders and projects are searched for copybooks, by defining it in the project's properties.
Linked resources are built in the background, just like other files in the project. You can see this happening in the COBOL Build console. As with any other file, you can choose to ignore linked resources when you build.