Eclipse treating all the files in a project as Der

2020-07-17 14:50发布

问题:

I have created a Dynamic Web Project in my Eclipse workspace. It is also a Maven project, and under SVN control. But in "Open Resource" (Ctrl+Alt+R) no file from this project appears, unless I check from the window's options (top right drop-down) "Show Derived Resources".

I have checked on some of the project's folders and they are not marked as "Derived".

I have two more (plain Java) projects in the workspace, and all the files from them are visible in "Open Resource".

Do you know what might be wrong with either Eclipse, the Maven plugin or Subclipse (the SVN plugin)?

回答1:

I experienced a similar issue in Eclipse (Ganymede), when using the Maven and Subclipse plugins. I have not determined which plugin caused this problem, but I suspect that it is related to my pom.xml containing nested modules (ie. a <modules><module>main-module</module><module>integration-test</module>). These appear in Eclipse as nested folders with their own pom.xml files (I did not use the Multiple Projects plugin although I have installed it).

I assume that one of the plug-ins has incorrectly set the derived flag on these folders when I checked out the project by SVN and then updated the MVN dependencies and project settings.

When I right click->properties on the top-level nested module directories I can see the Derived flag is checked. By unchecking the derive flag on the module directories (and checking the derive flag on the target directories within each sub-module instead), it fixed the Open Resource functionality.

As the derived flag is inherited from directories, you may need to check all of your directories in the hierarchy to find the 'culprit'.

If it helps the plug-in authors, my top level module directories contain a hyphen '-' in their names. Maybe that is throwing out one of the plugins.



回答2:

I think it is the maven plugin:

Jira issue

See also the notes for July 31, 2008 at the New and Noteworthy page for m2eclipse.

Several other nice links deleted because of restrictions of stackoverflow.



回答3:

In fact, I think that somehow this is eclipse in its own right, as I don't have m2eclipse or using maven for this.

By default, eclipse uses /bin as the target directory. My situation is similar to having maven in the project in that the target directory was changed to lib/classes to accommodate an existing project.

I started seeing issues similar to what is reported here, and while searching for the problem, came across this solution. Eclipse somehow didn't "uncheck" the bin directory as no longer derived, so I ran into the same issues. I tried replicating it, but I couldn't.



标签: eclipse