springboo2_pom.xml模板

dependencies|父项目|子项目模式

dependencies项目

负责所有jar包的版本声明,是一个独立项目,pom.xml里不用继承父项目 ,并且先要clean install 然后父项目的dependanceManagement才能引用

<?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>com.xxx.xxshpxx</groupId>
    <artifactId>xxshpxx-dependencies</artifactId>
    <version>0.1</version>
    <packaging>pom</packaging>

    <properties>
        <project.version>0.1</project.version>
        <java.version>1.8</java.version>
        <guava.version>26.0-jre</guava.version>
        <!--httpClient--->
        <retrofit2.version>2.3.0</retrofit2.version>
        <okhttp3.version>3.8.0</okhttp3.version>
        <!--shiro&jwt-->
        <shiro.version>1.4.0</shiro.version>
        <jwt.version>3.1.0</jwt.version>
        <!--mybatis-->
        <mybatis.starter.version>1.3.2</mybatis.starter.version>
        <pagehelper.version>1.2.7</pagehelper.version>
        <mybatis.generator.version>1.3.7</mybatis.generator.version>
        <!--工具类-->
        <commons.codec.version>1.11</commons.codec.version>
        <commons.lang3.version>3.8</commons.lang3.version>
        <jackson.xml.version>2.9.5</jackson.xml.version>
        <oss.version>3.1.0</oss.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!--具体的业务模块代码-->
            <dependency>
                <groupId>com.cmiinv.shp</groupId>
                <artifactId>shp-auth</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
                <!--26.0-jre-->
            </dependency>
            <!--httpclient  start-->
            <dependency>
                <groupId>com.squareup.retrofit2</groupId>
                <artifactId>retrofit</artifactId>
                <version>${retrofit2.version}</version>
                <!--2.3.0-->
            </dependency>
            <dependency>
                <groupId>com.squareup.retrofit2</groupId>
                <artifactId>converter-jackson</artifactId>
                <version>${retrofit2.version}</version>
                <!--2.3.0-->
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>logging-interceptor</artifactId>
                <version>${okhttp3.version}</version>
                <!--3.8.0-->
            </dependency>
            <!--httpclient  end-->
            <!--Shiro-->
            <dependency>
                <groupId>org.apache.shiro</groupId>
                <artifactId>shiro-spring</artifactId>
                <version>${shiro.version}</version>
                <!--1.4.0-->
            </dependency>
            <dependency>
                <groupId>com.auth0</groupId>
                <artifactId>java-jwt</artifactId>
                <version>${jwt.version}</version>
                <!--3.1.0-->
            </dependency>
            
            <!--springboot集成mybatis-->
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis.starter.version}</version>
                <!--1.3.2-->
            </dependency>
            <!--mybatis的分页插件-->
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>${pagehelper.version}</version>
                <!--1.2.7-->
            </dependency>
            <!--阿里云图片上传-->
            <dependency>
                <groupId>com.aliyun.oss</groupId>
                <artifactId>aliyun-sdk-oss</artifactId>
                <version>${oss.version}</version>
                <!--3.1.0-->
            </dependency>
            <!--jackson序列化的依赖-->
            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-xml</artifactId>
                <version>${jackson.xml.version}</version>
                <!--2.9.5-->
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
            	<!--MBG插件的版本-->
                <plugin>
                    <groupId>org.mybatis.generator</groupId>
                    <artifactId>mybatis-generator-maven-plugin</artifactId>
                    <version>${mybatis.generator.version}</version>
                    <!--1.3.7-->
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

父项目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">
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.cmiinv.shp</groupId>
    <artifactId>shp</artifactId>
    <version>0.1</version>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <main.basedir>${basedir}</main.basedir>
    </properties>

    <build>
        <plugins>
            <plugin>
            	<!--JDK的编译版本-->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
    <!--引入独立的版本管理项目-->
        <dependencies>
            <dependency>
                <groupId>com.xxx.xxshpxx</groupId>
                <artifactId>xxshpxx-dependencies</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
	<!--编译的子项目-->
    <modules>
        <module>shp-dependencies</module>
        <module>shp-model</module>
        <module>shp-util</module>
    </modules>
</project>

子项目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">
    <parent>
        <artifactId>xxshpxx</artifactId>
        <groupId>com.xxx.xxshpxx</groupId>
        <version>0.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>xxshpxx-api</artifactId>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!--版本由springboot管理-->
        </dependency>
        <!--thymeleaf 里面包括了spring-boot-starter-web-->
	<dependency>
	    <groupId>org.springframework.boot</groupId>
	    <artifactId>spring-boot-starter-thymeleaf</artifactId>
	    <!--版本由springboot管理-->
	</dependency>
        <!--数据库相关*********************************start-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <!--版本由springboot管理-->
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <!--需要自己管理版本 <version>1.3.2</version>-->
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <!--版本由springboot管理-->
        </dependency>
        <!-- 分页插件 -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <!--需要自己管理版本 <version>1.2.7</version>-->
        </dependency>
        <!--数据库相关*********************************end-->
	<!--spring cache-->
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
             <!--版本由springboot管理-->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <!--版本由springboot管理-->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <!--版本由springboot管理-->
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
            <!--版本由springboot管理-->
        </dependency>
        <!--springboot负责配制文件及属性文件自动提示-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
            <!--版本由springboot管理-->
        </dependency>
        <!-- aspect -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <!--rabbitmq-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-amqp</artifactId>
        </dependency>
        <!--健康检查-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <!--springboot管理版本-->
        </dependency>

    </dependencies>

    <build>
        <finalName>shp-api</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!--版本由springboot管理-->
            </plugin>
        </plugins>
    </build>

</project>

即不继承springboot通过dependencyManagement声明springboot

<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>com.qbsea</groupId>
		<artifactId>mytest</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>mytest-simple</artifactId>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.5.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyanagement>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值