Eclipse file search finds the same file multiple times

后端 未结 11 1351
生来不讨喜
生来不讨喜 2020-12-23 20:22

In Eclipse I have two maven projects A and B, where A is a parent for B. The directory structure is the following:

A/pom.xml
A/B/pom.xml
A/B/...
11条回答
  •  鱼传尺愫
    2020-12-23 21:03

    There is an ancient bug which requests Eclipse to support nested projects. Opened 2008, won't happen soon, I guess.

    Since Eclipse doesn't support Maven's default nested module layout, you have to import each module individually which doesn't confuse Eclipse but it can confuse you as you can see in the search results. Similar things happen when you start to save launch configs in a module.

    There are several possible solutions:

    1. Get used to ignoring half the search results. Takes some discipline but no magic.

    2. Make sure your root project doesn't contain anything important that you might want to open from Eclipse (i.e. move the parent POM to a new module which must be a child of the root project). Now you can close the root project.

      Takes some discipline where to put things in your project and it's clumsy when you have to add new modules.

    3. Use the flat multi-module approach. This is an extension to #2, it looks odd and there might be plugins that are offended by that. So if you use a lot of nonstandard plugins, you should check whether they like the new layout.

提交回复
热议问题