简体   繁体   中英

Eclipse Project Reference Hierarchy

I am working on creating pluggable modules in my Product and have thus created multiple Java projects in my eclipse Workspace. I wish to maintain a proper hierarchy of project references so suppose the project works something like this:

  • Core Project (refers nothing).
  • Project 1 (refers Core Project).
  • Project 2 (Refers to Project 1 as well as Core Project).

Now in the Build path of Project 1 I have added Core Project in the Projects tab.
Now in the Build path of Project 2 I have added only the reference of Project 1 assuming that since Project 1 refers to Core Project, the references for Core Project will be available in Project 2 as well. But unfortunately Core Project is not visible to Project 2.
Would love any help I can get in achieving such a hierarchy if it is possible in Eclipse.

You'd better use maven and m2e plugin (eclipse maven integration)

  1. Add core dependency to project 1
  2. Add project 1 dependency to project 2

Let maven and eclipse do their job, everything will work like a charm..

由于似乎您要从项目2访问“核心”类,因此将核心作为项目2的依赖关系引用并不是错误的

Well, I posted the query to bug.eclipse.org and finally got the answer to it. Here is the link to the solution - https://bugs.eclipse.org/bugs/show_bug.cgi?id=472030

Goto the Order and Export tab of Project 1 in Configure Build path menu and check the checkbox beside Core Project. And then it is visible to the Project 2.
This is so because Eclipse does not export its dependencies by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM