Search code examples
eclipsemaven-2m2eclipse

Multi-module Maven project in Eclipse


I have a project which I'd like to split into multiple modules. Can I still have the project in Eclipse as a single project or do I need to make them separate projects?

When I moved the dependencies from the parent pom.xml to the child's they stopped being put on the Eclipse build path and so now none of the files will compile in Eclipse (though it did appear Maven was working from the command line.) And ideas what I might be doing wrong or tips for creating multi-module projects in Eclipse?


Solution

  • I finally managed to get this working. It's a hierarchy on the file system, but they show up in Eclipse as separate projects.

    E.g on the file system we have:

    parent
      |
      |-- child A
      |
      |-- child B
    

    But in Eclipse, it shows as:

      |-- parent
      |
      |-- child A
      |
      |-- child B
    

    To get them to show up in Eclipse you have to do:

    File > Import... > Existing Maven Projects