简体   繁体   English

Java中的项目依赖

[英]project dependency in java

I have made three java project say proj1, proj2, proj3.I have made proj2 dependent upon proj3. 我已经做了三个java项目,分别是proj1,proj2,proj3。我已经使proj2依赖于proj3。 proj1 dependent upon proj2. proj1取决于proj2。 Making project dependent i mean that i have given the name of the proj in the buidpath > project using Eclipse IDE. 使项目依赖于我意味着我已经使用Eclipse IDE在buidpath > project给出了proj的名称。

Now as far as i know if i try import some object in proj1 then the compiler will try to find the object in the proj1 then if not found it will try to find in proj2 else it will try to found in proj3. 现在据我所知,如果我尝试在proj1中导入某个对象,则编译器将尝试在proj1中找到该对象,然后如果找不到,它将尝试在proj2中找到,否则将尝试在proj3中找到。

But in my case if the object is not there in proj1 and proj2. 但是在我的情况下,如果proj1和proj2中不存在该对象。 Compiler is not trying to find it in proj3. 编译器不尝试在proj3中找到它。 it is throwing copilation error it is there in proj3. 它引发了proj3中存在的编译错误。 Please help me out. 请帮帮我。

Export Project 3 in Project 2. 在项目2中导出项目3。

  1. Go to project 2 转到项目2
  2. Open Project Properties -> Java Build Path 打开项目属性-> Java构建路径
  3. Select tab Order and Export 选择选项卡Order and Export
  4. Click the checkbox beside project 3 单击项目3旁边的复选框

You need to tick the "export" checkbox for proj3 in the dependencies of proj2. 您需要在proj2的依赖项中选中proj3的“导出”复选框。 That will export classes in proj3 to proj1 via proj2 这将通过proj2将proj3中的类导出到proj1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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