【SpringCloudAlibaba学习 01】创建父工程项目

文章目录

    • SpringBoot、SpringCloud、SpringCloudAlibaba版本对应关系
    • 第一步、创建父工程
    • 第二步、配置父工程Maven依赖
    • 第三步、本地项目上传Git仓库【这一步可不做】
      • 1、登录自己的Git
      • 2、进入个人主页,主页右上方处新建项目
      • 3、填写仓库名称等一些基本信息
      • 4、复制HTTPS地址(SSH地址)
      • 5、到开发工具中使用命令将本地项目与Git上创建的远程仓库进行绑定

SpringBoot、SpringCloud、SpringCloudAlibaba版本对应关系

Spring Cloud Alibaba Version Spring Cloud Version Spring Boot Version
2021.0.1 2021.0.1 2.6.x, 2.7.x
2021.1 2020.0.x 2.4.x, 2.5.x
2.2.8.RELEASE Spring Cloud Hoxton.SR12 2.3.12.RELEASE
2.2.7.RELEASE Spring Cloud Hoxton.SR12 2.3.12.RELEASE
2.2.6.RELEASE Spring Cloud Hoxton.SR9 2.3.2.RELEASE
2.1.4.RELEASE Spring Cloud Greenwich.SR6 2.1.13.RELEASE
2.2.1.RELEASE Spring Cloud Hoxton.SR3 2.2.5.RELEASE
2.2.0.RELEASE Spring Cloud Hoxton.RELEASE 2.2.X
2.1.13.RELEASE Greenwich 2.1.x
2.0.4.RELEASE(停止维护,建议升级) Finchley 2.0.x
1.5.1.RELEASE(停止维护,建议升级) Edgware 1.5.x

SpringBoot与SpringCloud版本对应关系参考地址:Spring Cloud
SpringBoot、SpringCloud、SpringCloudAlibaba版本对应关系参考地址:Spring Cloud Alibaba


第一步、创建父工程

【SpringCloudAlibaba学习 01】创建父工程项目_第1张图片
【SpringCloudAlibaba学习 01】创建父工程项目_第2张图片


第二步、配置父工程Maven依赖


<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.0modelVersion>

    <groupId>org.examplegroupId>
    <artifactId>SpringCloudAlibabaDemoartifactId>
    <version>1.0-SNAPSHOTversion>

    <properties>
        <java.version>1.8java.version>
        
        <spring.boot.version>2.6.3spring.boot.version>
        
        <spring.cloud.alibaba>2021.0.1.0spring.cloud.alibaba>
        
        <spring.cloud>2021.0.1spring.cloud>
        
        <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
        <maven.compiler.source>1.8maven.compiler.source>
        <maven.compiler.target>1.8maven.compiler.target>
    properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starterartifactId>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>

        
        <dependency>
            <groupId>org.springframework.cloudgroupId>
            <artifactId>spring-cloud-starter-bootstrapartifactId>
        dependency>

        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <optional>trueoptional>
        dependency>
    dependencies>

    
    
    <dependencyManagement>
        <dependencies>
            
            <dependency>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-starter-parentartifactId>
                <version>${spring.boot.version}version>
                <type>pomtype>
                <scope>importscope>
            dependency>

            
            <dependency>
                <groupId>com.alibaba.cloudgroupId>
                <artifactId>spring-cloud-alibaba-dependenciesartifactId>
                <version>${spring.cloud.alibaba}version>
                <type>pomtype>
                <scope>importscope>
            dependency>

            
            <dependency>
                <groupId>org.springframework.cloudgroupId>
                <artifactId>spring-cloud-dependenciesartifactId>
                <version>${spring.cloud}version>
                <type>pomtype>
                <scope>importscope>
            dependency>
        dependencies>
    dependencyManagement>

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

    <repositories>
        <repository>
            <id>centralid>
            <name>aliyun mavenname>
            <url>http://maven.aliyun.com/nexus/content/groups/public/url>
            <layout>defaultlayout>
            
            <releases>
                <enabled>trueenabled>
            releases>
            
            <snapshots>
                <enabled>falseenabled>
            snapshots>
        repository>
    repositories>
project>

第三步、本地项目上传Git仓库【这一步可不做】

1、登录自己的Git

Git地址


2、进入个人主页,主页右上方处新建项目

【SpringCloudAlibaba学习 01】创建父工程项目_第3张图片


3、填写仓库名称等一些基本信息

【SpringCloudAlibaba学习 01】创建父工程项目_第4张图片


4、复制HTTPS地址(SSH地址)

【SpringCloudAlibaba学习 01】创建父工程项目_第5张图片


5、到开发工具中使用命令将本地项目与Git上创建的远程仓库进行绑定

步骤如下:

git init
git add .
git commit -m 'init'
git remote add origin 刚刚复制的HTTPS地址(SSH地址)
git pull --rebase origin master
git push -u origin master

下一篇,整合Nacos




End



你可能感兴趣的:(微服务,spring,boot,spring,cloud,java,微服务)