Eclipse: The resource is not on the build path of a Java project

后端 未结 13 1382
栀梦
栀梦 2020-12-04 17:23

I have been given a Source Folder (src) of a Java Project. I have created a .project file, kept it inside that folder and imported that Project int

相关标签:
13条回答
  • 2020-12-04 18:03
    1. Delete project from workspace (Uncheck physical deletion of project from disk)
    2. go to project location and delete .project file
    3. Import the project again.
    0 讨论(0)
  • 2020-12-04 18:05

    It means your project isn't on the compilation path of Eclipse.If after the accepted answer problem persists then you need to first place that project in the compilation path. For that you need to import the project again in your workspace, after that it will work fine.

    Similar problem came to me and I did whatever I have told you and it worked for me.

    0 讨论(0)
  • 2020-12-04 18:05

    Using Eclipse Oxygen with a multimodule maven project make sure you're not editing the file in the maven parent project.

    This caused the "Open Declaration', 'Open Type Hierarchy' and 'Open Call Hierarchy' to show the dreaded dialog in question. It would even mess with the autocomplete.

    Make sure you are not editing the parent project and instead edit the child project to avoid the error.

    0 讨论(0)
  • 2020-12-04 18:07

    In my case, I had a java project containing many subfolders, each containing its own src folder.

    project
    -subfolder
    --src/main/java
    -subfolder2
    --src/main/java
    

    There was no options available when I used the Build Path -> right click option, as outlined by other responses.

    I had to go to Project -> Properties -> Project Facets and click convert to faceted project.

    Then I got all the src folders added to the build path.

    0 讨论(0)
  • 2020-12-04 18:10

    All you got to do is move your Project folder under the Src, that is all, it is done. Let me know if any more questions.

    0 讨论(0)
  • 2020-12-04 18:11

    I am trying to set up a dynamic web project using eclipse and its maven plugin. I am selecting maven-archetype-webapp and facing the same problem (which I run onto when trying to automatically produce getters and setters for some attributes).

    My way around this was to right-click on the project, select Build Path --> Configure Build Path and then remove a weird exclusion filter "Excluded:**" which I found under the entry /src/main/resources.

    0 讨论(0)
提交回复
热议问题