3

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

3 Answers 3

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Sean, Okay let's say i have project "D" which is pure eclipse java project. I right-click > enable dependency management > it create POM.xml file. My problem is, I want make project "D" as child project of parent project "A". Project "A" contain packaging type "POM". I attempt another way also, after i turn my existing project "D" into mavan java project. I delete project (not physical location) and then, i Import > Maven > Existing Maven Project. However it does not make linked. Any suggestion
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>

Comments

0

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.

2 Comments

That's nonsense. Use either m2e, or eclipse:eclipse, but not both.
I have m2eclipse. I have a project of multi-module, what i want is to convert my existing eclipse project to multi-module for e.g a project "A" is parent project which contain "POM" type packaging and there are child projects "B" and "C", which has linked to project "A". Now I have existing eclipse project called "D", which want to linked with parent project "A". How to solve this issue ? I am not looking create new multi-module project. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.