Announcement Announcement Module
Collapse
No announcement yet.
Importing multi-module maven project - parent pom not displaying Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing multi-module maven project - parent pom not displaying

    I ve imported a multi module maven project into my workspace but STS wont show the parent pom in the top level directory - i.e. it just shows the child modules (which equate to sub folders on the file system)

    how can I get it to show the parent pom which is at the same level as the sub folders


    parent dir (pointed sts at this dir when importing maven proj, it then discovered sub modules)
    -----------
    pom.xml (this is not displayed in workspace. How can I have it displayed ?????)
    moduleA (in sub dir)
    moduleB (in sub dir)
    moduleC (in sub dir)

    thanks

  • #2
    How did you import the projects? Through a wizard, like File -> Import -> Existing maven projects? Or did you run mvn eclipse:eclipse on the command line?

    If through a wizard, it should allow you to import parent pom projects. Just run it again and make sure to point to the parent project. You may need to remove the projects from the workspace (but don't delete them!).

    If using mvn eclipse:eclipse, this should work too. Just make sure to point your existing project import wizard to the parent project.

    However, I should warn that Eclipse does not handle parent pom projects particularly well, so I'd recommend not importing it unless there is an extremely good reason.

    Comment


    • #3
      Why is that Andrew? I've never heard of this problem before but haven't really used parent poms.

      Comment


      • #4
        The problem is with nested folders. Eclipse does not support hierarchical projects, but maven does. When importing a parent pom, all the enclosed projects are imported as folders. So, this means that resources (folders, files, etc) are found twice in the workspace (once in the parent project through a nested folder, and once in the child project).

        It's possible to import a parent project, but filter out folders that correspond to child projects, but m2e doesn't do this (our gradle tooling does, and thus avoids the problem).

        So, although it's possible, I wouldn't recommend importing the parent pom. These projects tend to be simple enough, often with just a single pom file.

        Comment


        • #5
          Importing multi-module maven project - parent pom not displaying

          ah yes, my mistake is that I was selecting all the projects instead of just the parent

          thank you

          Originally posted by Andrew Eisenberg View Post
          How did you import the projects? Through a wizard, like File -> Import -> Existing maven projects? Or did you run mvn eclipse:eclipse on the command line?

          If through a wizard, it should allow you to import parent pom projects. Just run it again and make sure to point to the parent project. You may need to remove the projects from the workspace (but don't delete them!).

          If using mvn eclipse:eclipse, this should work too. Just make sure to point your existing project import wizard to the parent project.

          However, I should warn that Eclipse does not handle parent pom projects particularly well, so I'd recommend not importing it unless there is an extremely good reason.

          Comment


          • #6
            Late response: But Maven module projects doesn't demand the child projects to be physically placed in subfolders. They can be side by side too. So if you have that layout, this would likely work out without these type of issues in STS?

            Comment

            Working...
            X