目前我们完成了基础组件的搭建,所以接下来就是创建项目了。
你问我不就是个人博客吗?springboot就行了为什么要用springcloud?
因为想找工作,所以增加一下复杂度嘛。
一、创建Git仓库
注意!!!请先在本地安装一个Git,同时学习一下Git基本用法以及Git到底是个什么东西。
GitHub官网中创建项目,看着选一下就行,访问不了也可以使用Gitee。

创建完成后就会跳转这样一个页面。 然后直接通过github提供的链接克隆项目即可

指令
bash
git clone 你的仓库地址

然后文件夹内会有一个隐藏文件 .git

到这里这个项目就与这个git地址绑定,后续的提交等操作就会提交到这个仓库中。因为idea集成Git我们后续就不再需要命令窗口来进行指令操作了,只需要点几下就行。(之前上大学时候不知道,手敲了好长一段时间的Git命令)
二、 创建一个Maven项目
文件路径以及名称与刚刚的克隆下来的项目文件名一致,它会自己覆盖进去

目录结构

创建项目后第一件事当然是修改Maven配置

然后是pom.xml文件
初始长这样

注意!!!版本可以不同但一定要注意是否冲突
修改后
XML
<?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>org.myBlog</groupId>
<artifactId>myBlog</artifactId>
<!--指定打包方式-->
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<!--后续引入其他服务-->
<modules>
<module>blogAdmin</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!--总的依赖管理-->
<dependencyManagement>
<dependencies>
<!--SpringCloud依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2022.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--SpringCloudAlibaba-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2022.0.0.0-RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--SpringBoot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.13</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
最后删除src文件夹

三、创建Module
因为spring官网创建项目已经没有jdk8的选项所以这里需要换源
https://start.aliyun.com/

我将服务大概拆解为前台和后台,所以创建俩个module即可,同时修改pom.xml配置
XML
<?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>org.myBlog</groupId>
<artifactId>myBlog</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.biogAdmin</groupId>
<artifactId>blogAdmin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>blogAdmin</name>
<description>blogAdmin</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.0</version>
</plugin>
</plugins>
</build>
</project>
两个module我就不一个一个展示了,需要注意的也只有一个点


最终目录结构

自此我们便完成了项目创建的部分,最后我们在把代码网远程仓库提交一下就行
如此便是没有问题
最后执行 git push 即可

最后检查远程仓库

简直完美
首次使用Git需要完成注册、授权等操作,这些网上都有跟着操作一下就行。