乐趣区

关于maven:汇总Maven常用依赖包

将开发过程罕用的 maven 依赖汇总下来,不必每次都去 maven 仓库查问,能够节俭很多工夫。

– pom.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>
    
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.1</version>
        <relativePath/>
    </parent>
    
    <groupId>com.daoge.seata</groupId>
    <artifactId>spring-boot-samples</artifactId>
    <name>spring-boot-samples</name>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <springboot.verison>2.5.1</springboot.verison>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <version>${springboot.verison}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven-deploy-plugin.version}</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

– springboot

<properties>
    <springboot.verison>2.5.1</springboot.verison>
</properties>

<dependencies>
    <!--spring-boot-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <version>${springboot.verison}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${springboot.verison}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${springboot.verison}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${springboot.verison}</version>
    </dependency>
</dependencies>

– db

<properties>
    <mysql-connector.version>5.1.49</mysql-connector.version>
    <druid.version>1.2.6</druid.version>
    <mybatis.version>2.2.0</mybatis.version>
    <mybatis-plus.version>3.4.3</mybatis-plus.version>
    <tk-mybatis.version>2.1.5</tk-mybatis.version>
    <lombok.version>1.18.20</lombok.version>    
</properties>

<dependencies>
    <!--db-->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql-connector.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.version}</version>
    </dependency>
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus</artifactId>
        <version>${mybatis-plus.version}</version>
    </dependency>
    <dependency>
        <groupId>tk.mybatis</groupId>
        <artifactId>mapper-spring-boot-starter</artifactId>
        <version>${tk-mybatis.version}</version>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
    </dependency>
</dependencies>

– nacos

<properties>        
    <nacos.version>0.2.3</nacos.version>
    <nacos-client.verison>1.1.3</nacos-client.verison>  
</properties>

<dependencies>
    <!--nacos client-->
    <dependency>
        <groupId>com.alibaba.nacos</groupId>
        <artifactId>nacos-client</artifactId>
        <version>${nacos-client.verison}</version>
    </dependency>
</dependencies>

– dubbo

<properties>        
    <apache.dubbo.version>3.0.0</apache.dubbo.version>
</properties>

<dependencies>
    <!--dubbo-->
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>${apache.dubbo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo</artifactId>
        <version>${apache.dubbo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo-registry-nacos</artifactId>
        <version>${apache.dubbo.version}</version>
    </dependency>
</dependencies>

– seata

<properties>        
    <seata-spring-boot-starter.version>1.4.2</seata-spring-boot-starter.version>
    <seata-all.version>1.4.2</seata-all.version>
</properties>

<dependencies>
    <!-- seata -->
    <dependency>
        <groupId>io.seata</groupId>
        <artifactId>seata-spring-boot-starter</artifactId>
        <version>${seata-spring-boot-starter.version}</version>
        <exclusions>
            <exclusion>
                <groupId>io.seata</groupId>
                <artifactId>seata-all</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.seata</groupId>
        <artifactId>seata-all</artifactId>
        <version>${seata-all.version}</version>
    </dependency>
</dependencies>        

– netty

<properties>     
    <netty-all.version>4.1.32.Final</netty-all.version>
</properties>

<dependencies>
    <!--netty-->
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
        <version>${netty-all.version}</version>
    </dependency>
</dependencies>

– utils

<properties>     
    <apache.httpclient.version>4.5</apache.httpclient.version>
    <alibaba.spring-context-support.version>1.0.11</alibaba.spring-context-support.version>
    <fastjson.version>1.2.47</fastjson.version>
    <commons-lang3.version>3.9</commons-lang3.version>
    <guava.version>27.0.1-jre</guava.version>
</properties>

<dependencies>
    <!--httpclient-->
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>${apache.httpclient.version}</version>
    </dependency>
    <!-- 应用 Spring 拆卸形式时可选 -->
    <dependency>
        <groupId>com.alibaba.spring</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>${alibaba.spring-context-support.version}</version>
    </dependency>
    <!-- fastjson -->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>${fastjson.version}</version>
    </dependency>
    <!-- commons-lang3 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang3.version}</version>
    </dependency>
    <!-- guava -->
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</version>
    </dependency>
</dependencies>

微信公众号 – 稻哥说编程(RedCode1024)博主,从事程序开发 10 余年,分享有用的行业解决方案,欢送留言交换。

退出移动版