开发者

Eclipse cannot load resources directory (Build Path Problem)

I found there is an exclamation mark in the icon of my project. I guess it is caused by the resources directory is not loaded.

Here is part of my .classpath file, anything can be wrong?

<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>

The problem Eclipse shows is

Project 'dingdong' is missing required source folder: 'src/main/resources' dingdong Build path Build Path P开发者_StackOverflowroblem


Just adding this here if someone stumbles on the same question: The problem was solved by refreshing the project (Selecting the project root and hitting F5), see comments.

Eclipse does not refresh the workspace projects by default when starting up. You can add an start-up option (the flag is -refresh, see here for details) for performing a global refresh of the workspace on startup. This will reconcile any changes that were made in the file system since the platform was last run.

Removing and re-adding the source folder to project Build path can be done like this:

  • Right click on the source folder, select Build path -> Remove from build path
  • Select the folder from the "normal" (non-source folder) -directory tree (usually shows way down in your project tree), right click the desired directory and select Build path -> Use as Source folder


Refreshing the project, which is what the accepted answer suggests, failed for me.

Here is what I did to resolve this issue:

  1. Right click , and then select Build Path -> Configure Build Path... -> Order and Export
  2. Look for the src/main/resources folder in the entries list. Mine was called <my project folder>/src/main/resources.
  3. Move <my project folder>/src/main/resources to the bottom of the dependency list by selecting it and clicking the button titled Bottom.

This resolved the issue for me. In my case, the resources entry was above the src/main/java and src/main/test entries, which seems to have been causing problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜