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

后端 未结 2 503
滥情空心
滥情空心 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条回答
  •  别那么骄傲
    2020-12-19 10:16

    Not sure if this is what you're looking for. Try this -

    1. In Eclipse, right-click Project2, select Build Path -> Configure Build Path
    2. Go to Order and Export tab. it should have Project1 listed. Check the box in front of it.
    3. Rebuild your projects.

    Basically, you're exporting the Project1 dependency from project2. So any project that adds project2 as a dependency will see Project1 too without explicitly having to add it to the classpath. Eclipse will transparently do that.

提交回复
热议问题