Results 1 to 6 of 6

Thread: Importing multi-module maven project - parent pom not displaying

  1. #1

    Default 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. #2
    Join Date
    Aug 2008
    Location
    Vancouver, BC
    Posts
    748

    Default

    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.
    Andrew Eisenberg, Ph.D.
    SpringSource, a division of VMware
    SpringSource Tools Team
    More about AJDT, Groovy-Eclipse, and Grails tooling

  3. #3
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

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

  4. #4
    Join Date
    Aug 2008
    Location
    Vancouver, BC
    Posts
    748

    Default

    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.
    Andrew Eisenberg, Ph.D.
    SpringSource, a division of VMware
    SpringSource Tools Team
    More about AJDT, Groovy-Eclipse, and Grails tooling

  5. #5

    Default 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

    Quote 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.

  6. #6
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •