Getting the following build error: “the type {---} cannot be resolved. it is indirectly referenced from required .class files”

后端 未结 2 496
滥情空心
滥情空心 2020-12-19 09:28

So, I have the following setup in Eclipse (Java):

  1. I have a project (lets call this \"project 1\") which provides an interface (which is package private)
  2. <
2条回答
  •  Happy的楠姐
    2020-12-19 10:12

    This is a "transitive dependency". You need on your classpath all classes that are required by any class you use. So you need to have the classes from project 1 in the classpath somehow - you can package them as a .jar, for example. Or you can go to Build Path > Order and Export of Project 2, and mark Project 1 as exported.

    An important thing here is that the project dependencies are a mere development "goodie" - when you execute the program standalone (or deploy it to container), the Eclipse project dependencies are gone. So you must ensure your dependencies are met.

提交回复
热议问题