Eclipse error: indirectly referenced from required

2019-01-02 23:32发布

I got an error in Eclipse. What does this error message means:

The type iglu.ir.TermVector cannot be resolved. It is indirectly referenced from required .class files

标签: eclipse
20条回答
劫难
2楼-- · 2019-01-02 23:59

I had an interesting case of this problem with Eclipse 4.4.2. My project (P1) referenced an external class (project P2) with two methods with the same name but different argument types:

public static void setItem(Integer id) …
public static void setItem(Item item) …

The type Item was contained in a third project P3, which I did not want to be visible here. P1 called only the first method:

ExternalClass.setItem(Integer.valueOf(12345));

So the second method, which used the Item class, was not used, and it is true that P3 was not in the compilation classpath – why should it if it is not used.

Still Eclipse told me

The type ...Item cannot be resolved.
It is indirectly referenced from required .class files

Compiling from the command line did not produce any such issues. Changing the name of the second method (unused here!) made the problem go away in Eclipse, too.

查看更多
别忘想泡老子
3楼-- · 2019-01-03 00:02

It happens to me sometimes, I always fixed that with "mvn eclipse:clean" command to clean old properties and then run mvn eclipse:eclipse -Dwtpversion=2.0 (for web project of course). There are some old properties saved so eclipse is confused sometimes.

查看更多
登录 后发表回答