eclipse 资源不在 java 项目的构建路径上?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18058076/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:50:10  来源:igfitidea点击:

The resource is not on the build path of a java project?

eclipsemaven

提问by user1954970

I have a Maven project on my Eclipse. When I perform call hierarchy I get the message:

我的 Eclipse 上有一个 Maven 项目。当我执行呼叫层次结构时,我收到消息:

The resource is not on the build path of a java project.

该资源不在 java 项目的构建路径上。

What needs to be configured for this?

为此需要配置什么?

回答by user1954970

I followed the following steps it worked:

我按照以下步骤操作:

  1. Properties->project facets->check java->ok
  2. convert to maven project.
  1. 属性->项目方面->检查java->确定
  2. 转换为 Maven 项目。

回答by Gab

assuming you're expecting a call hierarchy in your own code, ensure that all sources are located in src/main/java directory.

假设您希望在自己的代码中使用调用层次结构,请确保所有源都位于 src/main/java 目录中。

Did you installed eclipse m2e plugin ? Do your eclipse recognize the project as a maven project ? (right click > maven > convert to maven project)

您是否安装了 eclipse m2e 插件?您的 Eclipse 是否将该项目识别为 Maven 项目?(右键单击 > maven > 转换为 maven 项目)

回答by nomail

I have this quite often. Seems bug in Eclipse. Quit/restart Eclipse seems the easiest to get things working again.

我经常有这种情况。似乎是 Eclipse 中的错误。退出/重新启动 Eclipse 似乎最容易让事情重新开始工作。

回答by nomail

Since you are working on a maven project, so Every resource must be included in pom.xml file, if not, the external file must be included as a jar file. Also, if you are not able to open the call hierarchy, the project which is being referred must be open in your Eclipse workspace.

由于是maven项目,所以每个资源都必须包含在pom.xml文件中,如果没有,则必须将外部文件作为jar文件包含。此外,如果您无法打开调用层次结构,则被引用的项目必须在您的 Eclipse 工作区中打开。