Springcloud_H版-alibaba学习笔记(一) 创建maven项SpringCloud

该文介绍了如何创建一个SpringCloud项目的父POM文件,用于统一管理各个子模块的jar包版本。配置包括项目基本信息、模块定义、属性定义以及依赖管理部分,涉及SpringBoot、SpringCloud及Alibaba的相关版本,并包含其他如MyBatis、Druid、Log4j等常用库的版本锁定。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、创建maven项SpringCloud

项目父pom

工程父pom 用于统一进行jar包版本管理。

<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.dt.springcloud</groupId>  
    <artifactId>dt-SpringCloud-2020</artifactId>  
    <version>1.0.0-SNAPSHOT</version>  
    <name>dt-SpringCloud-2020</name>  
    <packaging>pom</packaging><!--项目的打包类型:pom jar war  pom的意思是项目里没有java代码,也不执行任何代码,只是为了聚合工程或传递依赖用的。所以并不会寻找配置文件 -->  
  
    <modules>  
        <module>cloud-provider-payment8001</module>  
    </modules>  
  
    <!--统一管理jar包版本-->  
    <properties>  
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
        <maven.compiler.source>1.8</maven.compiler.source>  
        <maven.compiler.target>1.8</maven.compiler.target>  
        <junit.version>4.12</junit.version>  
        <log4j.version>1.2.17</log4j.version>  
        <mysql.version>8.0.31</mysql.version>  
        <druid.version>1.2.16</druid.version>  
        <lombok.version>1.18.26</lombok.version>  
        <spring.boot.version>2.2.2.RELEASE</spring.boot.version>  
        <spring.cloud.version>Hoxton.SR1</spring.cloud.version>  
        <spring.cloud.alibaba.version>2.1.0.RELEASE</spring.cloud.alibaba.version>  
        <mybatis.spring.boot.version>1.3.2</mybatis.spring.boot.version>  
    </properties>  
    <!--子模块继承后,提供作用:锁定版本+子module不用groupId和version-->  
    <dependencyManagement>  
        <dependencies>  
            <!--  springboot 2.2.2    -->  
            <dependency>  
                <groupId>org.springframework.boot</groupId>  
                <artifactId>spring-boot-dependencies</artifactId>  
                <version>2.2.2.RELEASE</version>  
                <type>pom</type>  
                <scope>import</scope>  
            </dependency>  
            <!--  spring cloud Hoxton.SR1   -->  
            <dependency>  
                <groupId>org.springframework.cloud</groupId>  
                <artifactId>spring-cloud-dependencies</artifactId>  
                <version>Hoxton.SR1</version>  
                <type>pom</type>  
                <scope>import</scope>  
            </dependency>  
            <!--  spring cloud alibaba 2.1.0.RELEASE    -->  
            <dependency>  
                <groupId>com.alibaba.cloud</groupId>  
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>  
                <version>2.2.0.RELEASE</version>  
                <type>pom</type>  
                <scope>import</scope>  
            </dependency>  
            <dependency>  
                <groupId>mysql</groupId>  
                <artifactId>mysql-connector-java</artifactId>  
                <version>${mysql.version}</version>  
            </dependency>  
            <dependency>  
                <groupId>com.alibaba</groupId>  
                <artifactId>druid</artifactId>  
                <version>${druid.version}</version>  
            </dependency>  
            <dependency>  
                <groupId>org.mybatis.spring.boot</groupId>  
                <artifactId>mybatis-spring-boot-starter</artifactId>  
                <version>${mybatis.spring.boot.version}</version>  
            </dependency>  
            <dependency>  
                <groupId>log4j</groupId>  
                <artifactId>log4j</artifactId>  
                <version>${log4j.version}</version>  
            </dependency>  
            <dependency>  
                <groupId>junit</groupId>  
                <artifactId>junit</artifactId>  
                <version>${junit.version}</version>  
            </dependency>  
            <dependency>  
                <groupId>org.projectlombok</groupId>  
                <artifactId>lombok</artifactId>  
                <version>${lombok.version}</version>  
                <optional>true</optional>  
            </dependency>  
        </dependencies>  
    </dependencyManagement>  
  
    <!--工具类-->  
    <dependencies>  
        <dependency>  
            <groupId>commons-io</groupId>  
            <artifactId>commons-io</artifactId>  
            <version>2.6</version>  
        </dependency>  
        <dependency>  
            <groupId>org.apache.commons</groupId>  
            <artifactId>commons-lang3</artifactId>  
            <version>3.12.0</version>  
        </dependency>  
        <dependency>  
            <groupId>com.alibaba</groupId>  
            <artifactId>fastjson</artifactId>  
            <version>1.2.70</version>  
        </dependency>  
        <dependency>  
            <groupId>cn.hutool</groupId>  
            <artifactId>hutool-all</artifactId>  
            <version>5.3.5</version>  
        </dependency>  
        <dependency>  
            <groupId>com.google.guava</groupId>  
            <artifactId>guava</artifactId>  
            <version>[19.0,)</version>  
        </dependency>  
        <!-- mail -->  
        <dependency>  
            <groupId>javax.mail</groupId>  
            <artifactId>mail</artifactId>  
            <version>1.4.7</version>  
        </dependency>  
        <!--测试使用-->  
        <dependency>  
            <groupId>org.springframework.boot</groupId>  
            <artifactId>spring-boot-starter-test</artifactId>  
            <scope>test</scope>  
        </dependency>  
        <dependency>  
            <groupId>junit</groupId>  
            <artifactId>junit</artifactId>  
            <version>4.12</version>  
            <scope>test</scope>  
        </dependency>  
        <!--框架类-->  
        <dependency>  
            <groupId>com.github.pagehelper</groupId>  
            <artifactId>pagehelper-spring-boot-starter</artifactId>  
            <version>1.2.10</version>  
        </dependency>  
          <!--Swagger start-->  
        <dependency>  
            <groupId>io.springfox</groupId>  
            <artifactId>springfox-swagger2</artifactId>  
            <version>2.10.5</version>  
        </dependency>  
        <dependency>  
            <groupId>com.github.xiaoymin</groupId>  
            <artifactId>swagger-bootstrap-ui</artifactId>  
            <version>1.9.6</version>  
        </dependency>  
        <!--Swagger end -->  
    </dependencies>   
</project>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值