How to create an empty multi module Maven project?

Viewed 78124

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 archetype:create inside the parent directory to create sub modules but archetype:create has become deprecated since then.

Any recommendations on how to create new Maven multi-module projects?

8 Answers

Here is a screencast on how you could do it with Intellij Idea. First, start a new project (File -> New Project), choose 'Maven Module':

enter image description here

Type in a name, click next, don't change anything else in the following steps, click finish.

Now in your pom.xml type <packaging> and enable auto-updates:

enter image description here

Type in modules:

enter image description here

Place your cursor at m1 and press Alt+Enter.

enter image description here

Module m1 will be automatically added to your project. Now you can do Alt+Enter for m2 and that's it.

enter image description here

You can also start by adding pom.xml for an existing module of your project: right click on it in the project tree, 'Add Framework Support...', choose 'Maven'. This will create a pom.xml.

Related