Convert eclipse java project to maven module project

12,460

Solution 1

First create pom.xml files in all projects, then:

Old school:

Run mvn eclipse:eclipse, switch to eclipse and do Import > Existing Projects

New School:

Install m2e, don't run eclipse:eclipse (because it has no effect on m2e) and do Import > Maven > Existing Maven Projects

Don't mix the two, they are not compatible with each other.

Solution 2

You have to configure the pom.xml of the child project ("D"). You need to insert the tag with the follow configuration: groupId, artifactId and version.

And into the parent's pom.xml you need to add the new module child ( tag).

e.g. D pom.xml

<parent>
    <groupId>com.project.A</groupId>
    <artifactId>A</artifactId>
    <version>1.0.0</version>
</parent>

A pom.xml

<modules>
    <module>D</module> --> It is the artifact Id
    <module>...</module>
    <module>...</module>
</modules>
Share:
12,460
user553710
Author by

user553710

Updated on June 04, 2022

Comments

  • user553710
    user553710 about 2 years

    I have java project, i want to convert a multi-module project (module). I have a parent project, i want to add my existing project in parent. I like a eclipse style file structure does it possible to add existing project in Parent.

    Thank you,

    Regards and Metta, Ichiro hang