preface

I recently started learning about the new version of SpringCloud 2020.0.2 and getting ready to use the new architecture, as shown in the figure



So document the creation of a multi-module project using IDEA, and document the setup step by step

Create a Project (New Project)









Add a New Module.







References to SpringCloud preoperations

1. Delete SRC directory under ztosin-parent project



2. Modify the pom.xml of the Ztosin-parent project

<? The 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" > The < modelVersion > 4.0.0 < / modelVersion > < artifactId > ztosin - nacossvr < / artifactId > < the parent > < the groupId > org. Springframework. Boot < / groupId > < artifactId > spring - the boot - starter - parent < / artifactId > < version > 2.4.5 < / version > < / parent > < properties > < Java version > 1.8 < / Java version > < spring - the boot. Version > 2.4.4 < / spring - the boot. Version > < spring - cloud version > 2020.0.2 < / spring - cloud. Version > < spring - cloud - alibaba. Version > 2020.0 RC1 < / spring - cloud - alibaba. Version > < / properties > < dependencies > < the dependency > <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <! Springframework. boot</ grouppid > -- Spring boot -- dependency> < grouppid >org.springframework.boot</ grouppid > <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <! - spring cloud depend on - > < the dependency > < groupId > org. Springframework. Cloud < / groupId > <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <! Cloud </ grouppid > -- Dependency > <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>${spring-cloud-alibaba.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> < the groupId > com. The company < / groupId > < artifactId > dockerfile maven - plugin < / artifactId > < version > 1.4.10 < / version > <configuration> <dockerfile>src/main/docker/Dockerfile</dockerfile> <! -- <repository>spotify/foobar</repository>--> <! --<tag>${project.version}</tag>--> <buildArgs> <! --> <JAR_FILE>target/${project.build.finalName}. Jar </JAR_FILE> </buildArgs> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>

3, add NacosServerApplication. Java

package com.ztosin.nacossvr; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class NacosServerApplication { public static void main(String[] args) { SpringApplication.run(NacosServerApplication.class, args); }}

The final directory structure looks like this:

reference

Spring – Cloud uses IDEA to create multi-module projects