How to use idea to create gradle project with multiple subprojects in springboot framework

create project a,
includes sub-project brecedcpdd,
b is springboot startup project,
b depends on c, c depends on d, ask for instructions on how to establish-sharp-sharp-sharp problem description

Apr.01,2021

1. First create an empty project A
2. Create the first module project B (web)
3. Create a second module project C (core)
4. Establish the third module project D (common)
1. Specify the included modules

in the pom file of the A top-level project.
<groupId>com.aa</groupId>
<artifactId>project</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<!-- module -->
<modules>
    <module>project-common</module>
    <module>project-core</module>
    <module>project-web</module>
</modules>
<!-- propertiesdependencyManagement -->
<properties>
    <learn-project.version>1.0.0-SNAPSHOT</learn-project.version>
</properties>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.aa</groupId>
            <artifactId>project-core</artifactId>
            <version>${learn-project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aa</groupId>
            <artifactId>project-web</artifactId>
            <version>${learn-project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.aa</groupId>
            <artifactId>project-common</artifactId>
            <version>${learn-project.version}</version>
        </dependency>
    </dependencies>
</dependencyManagement>

II. Write

in the pom.xml file of Project B
<parent>
    <groupId>com.aa</groupId>
    <artifactId>project</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
    <dependency>
        <groupId>com.aa</groupId>
        <artifactId>project-core</artifactId>
    </dependency>
</dependencies>

III. Write

in the pom.xml of C project.
<parent>
    <groupId>com.aa</groupId>
    <artifactId>project</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
        <dependency>
            <groupId>com.aa</groupId>
            <artifactId>project-common</artifactId>
        </dependency>
</dependencies>

from a project maintenance point of view, I personally don't recommend that you manage large engineering projects in a subproject nesting way, which will complicate the project, although gradle supports it and is simpler than maven. If you really need to do this, refer to the official documentation: ide/multi_project_builds.html" rel=" nofollow noreferrer "> https://docs.gradle.org/curre.

my personal recommendation is to maintain these sub-projects separately, package them into spring boot application, sub-projects in the main project and rely on them as plug-ins, all of which are pushed to maven warehouse (private maven warehouse can be built) for unified management and maintenance. This does not affect each other, and it is the correct posture of maven

Menu