user553710
user553710

Reputation: 210

Convert eclipse java project to maven module project

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

Upvotes: 3

Views: 14014

Answers (3)

Edson Jordão
Edson Jordão

Reputation: 21

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>

Upvotes: 2

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298818

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.

Upvotes: 8

lobster1234
lobster1234

Reputation: 7779

Install Maven Plugin for Eclipse (m2e). Then in your project (command line), at the root level type mvn eclipse:eclipse. Reimport the generated project in Eclipse (Import Existing Projects into Workspace) and you should be all set.

Upvotes: 0

Related Questions