问题
Maven allows parent-child relationship between projects. By default, parent project is expected locating in parent folder.
Is it possible to adopt this structure to Eclipse?
Currently I have imported all folders separately as project with sources without copying and consequently have separate nodes for each project in Package Explorer
.
Unfortunately it causes various glitches including EGit
functionning.
回答1:
Eclipse 4.5 (starting from Mars M5) will include a mechanism that allows to nested projects under their parent one. You can already give it a try by accessing the latest snapshot build of Eclipse Platform (which is a subset of the IDE, but which contains the change) http://download.eclipse.org/eclipse/downloads/drops4/N20150124-1500/ , when Mars M5 is ready, you'll be able to access from http://eclipse.org/downloads a full featured IDE which also contains this feature.
Reference https://bugs.eclipse.org/bugs/show_bug.cgi?id=427768
回答2:
Check this answer. Eclipse Workspace Plugin manages the resources in this hierarchy(or structure) and also exposes the APIs to handles these resources programmatically in the similar way.
All projects inside eclipse are identified by the presence of .project file inside the project folder. Refer this answer
回答3:
If you already store your projects as Maven expects them, i.e. the aggregator project in the top level directory and all its modules each in its own direct subdirectory you should be able to view modules as full fledged Eclipse projects by running import -> Maven -> Existing Maven projects
and then selecting the aggregator project's directory.
If this is not your structure it's more complicated if not impossible. With Subversion you can use externals to "hook" sub-projects to their aggregator, but I don't know if git supports a similar mechanism.
来源:https://stackoverflow.com/questions/22459126/nested-projects-and-project-folders-in-eclipse