Idea puts multiple spring boot projects in a MAVEN project

Source: Internet
Author: User
Tags parent directory

Now that the project has been built with spring boot, the biggest advantage of spring boot is that by default we can use spring without any configuration, and we can start it on our own without needing a web container. Now the project is a lot of micro-service mode, a project to be split into multiple services, services through the interface to invoke, each service can also start independently, do not need to rely on each other.

When I first started using idea, I was not used to it, because the difference with Eclipse was very big, but after using it, I found out that idea for this multi-module, MicroServices project is really much more convenient than eclipse, including deployment and build. Now for a moment, how to build a multi-module project in idea.

First, we need to build a MAVEN project, File->new, Project, find Maven on the left side of the pop-up window, click Maven, and then do not tick the create from archetype in the right window. Select the JDK version, click Next, fill in GroupID, Artifactid, click Next, fill in the ProjectName, click Finish. This creates a MAVEN project, but note that the <packaging> in the pom file for this MAVEN project is not written, which means that the default is the jar package, because we need to add multiple modules, so we need to add <packaging>pom </packaging>. This completes the creation of the parent project. At this point, the new parent project also has the SRC directory, because we do not need to write code in the parent directory, then we can

After that is to build the module, when the module is built, File->new-S, (can also right-click the project->new->module to create) Here the project Select Spring Boot INITIALZR, our module is the spring Boot starts and then the process of creating a new spring boot project is no longer explained. It is important to note that the directory location of the newly created module must be under the location of the previously created parent project. You can then create additional modules in the same way.

If you need to import a previously existing module into your current project, you can select the module from existing sources, and then choose the location of the modules, then select the Import module from the external mod El, select Maven, and then in root directory you will be able to place the module's directory under the parent directory. Other options are default, click Next, and click Done. Note: When importing a module that already exists, you cannot right-click the item->new->module to import it.

The above is the process of creating multiple Spring Boot module projects using idea, the problem is that you cannot build submodules directly from the parent project, and each module must be built and run separately.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.