Create Java projects with cyclic import in Eclipse

I have an outdated Java application (not my own) that I am trying to create in Eclipse Galileo.

Since this is not mine, I can’t talk about the quality of the design, but I come across a few examples where I will have something like this:

In a project called, for example, "lib_a", I will have a file containing this:

import com.acme.lib_b.onething;

The lib_b project, on the other hand, will contain:

import com.acme.lib_a.anotherthing;

Of course, the problem is that one project cannot be built, because errors prevent me from creating a .jar file that can be added as an external archive to another project, and vice versa.

It seems to me that this should be quite common when creating Java applications. Rewriting it from scratch is not an option, so I would like to know "what other people do."

+3
source share
4 answers

You can link projects in eclipse, so you essentially declare one project as a dependency of another, as a jar declaration.

Project: β†’ Properties β†’ go to the "projects" tab, click "add", and you will have the option of any open project. In addition, the eclipse tracks them so that when you open the linked project "A", B ".

+4
source

, - , (, ), , util.jar.

, .

+2

.

  • 2 , ""
  • 2
  • "" , , .
+2

.

If you cannot use A without B, and you cannot use B without A, having separate JAR files does not seem very useful.

+1
source

Source: https://habr.com/ru/post/1736347/


All Articles