How to create an empty multi module Maven project?

后端 未结 8 448
孤独总比滥情好
孤独总比滥情好 2020-12-04 05:19

Right now I usually find a pom.xml file on the web that has a pom packaging and copy and paste it to create my parent project. Then I used to run <

8条回答
  •  鱼传尺愫
    2020-12-04 05:52

    Simple 4 steps if you want to avoid xml copy paste.

    1. Create a 284(default) archetype project. Open the pom file created change the packaging from jar to pom

    2. Delete the src folder from the project - This is now the Parent project without src, since the packaging is pom. In the above folder create another new project(284 default). Change the packaging to war or ejb or ear. This becomes the sub module.

    3. Execute mvn eclipse:eclipse on each module. Now the project should be ready to be imported as a Eclipse Project.

    4. While importing the project, Eclipse would complain the below Project configuration is not up-to-date with pom.xml. Run Maven->Update Project or use Quick Fix. To avoid the above error right click and choose Quick Fix. This will update the POMS. Another way to avoid this error is by declaring the sub modules in the Parent pom

    Reference the below link for more details. http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Example_1

提交回复
热议问题