1. Create a Maven project

1.1 File -> New -> Project -> Maven

1.2 Setting groupId and artifactId

1.3 Setting the project name

1.4 Deleting the source Directory

2. Create an application entry module

2.1 Right-click the project to create a Springboot Module

2.2 Setting groupId and artifactId

3. Modify the root project pom.xml

3.1 Add modules and declare each module

<modules>
    <module>springboot-base</module>
</modules>
Copy the code

3.2 Add Properties to configure dependency version numbers and other configuration items

< the properties > < springboot - base - version > 1.0 - the SNAPSHOT < / springboot - base - version > < spring. The boot. Version > 2.2.0. RELEASE < / spring. The boot. Version > < / properties >Copy the code

3.3 Add dependencyManagement to manage the introduction of each JAR

At this point, the pom.xml file for the root project looks like this

<? xml version="1.0" encoding="UTF-8"? > <project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.jw</groupId>
    <artifactId>springboot-base-root</artifactId>
    <version>${springboot-base-version}</version> <modules> <module>springboot-base</module> </modules> <properties> < springboot - base - version > 1.0 - the SNAPSHOT < / springboot - base - version > < spring. The boot. Version > 2.2.0. RELEASE < / spring. The boot. Version >  </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>${spring.boot.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <version>${spring.boot.version}</version>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${spring.boot.version}</version>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring.boot.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
Copy the code

4. Modify the POM.xml of each submodule

4.1 Changing the Parent Module to the Root Module 4.2 Changing the version of the Current Module to the same as that of the parent Module The pom. XML file is as follows

<? xml version="1.0" encoding="UTF-8"? > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.jw</groupId>
		<artifactId>springboot-base-root</artifactId>
		<version>${springboot-base-version}</version>
	</parent>

	<groupId>com.jw</groupId>
	<artifactId>springboot-base</artifactId>
	<version>${springboot-base-version}</version> <name> Springboot-base </name> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>
Copy the code