不鸣则已

海阔凭鱼跃,天高任鸟飞!

首页 新随笔 联系 订阅 管理

父工程删除对spring boot启动项的引用,因为父工程 dependencyManagement,它不会自动加载包,只指定包的版本,

如果在父工程中引用了包,但是没有指定包版本,子工程将不会识别到包的版本,因此无法加载。

<?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.token</groupId>
    <artifactId>parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>parent</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <modules>
        <module>51token-consumer-api</module>
        <module>51token-consumer-sdk</module>
    </modules>

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

        <consumer.version>0.0.1-SNAPSHOT</consumer.version>

        <commons-collections4.version>4.1</commons-collections4.version>
        <commons-lang3.version>3.4</commons-lang3.version>
        <commons-pool2.version>2.5.0</commons-pool2.version>

        <swagger2.version>2.9.2</swagger2.version>
        <mysql-connector-java.version>5.1.46</mysql-connector-java.version>
        <druid.version>1.0.28</druid.version>
        <mybatis-spring-boot-starter.version>1.3.2</mybatis-spring-boot-starter.version>
    </properties>

    <dependencyManagement>
        <dependencies>

            <!-- base module -->
            <dependency>
                <groupId>com.token</groupId>
                <artifactId>51token-consumer-api</artifactId>
                <version>${consumer.version}</version>
            </dependency>
            <dependency>
                <groupId>com.token</groupId>
                <artifactId>51token-consumer-sdk</artifactId>
                <version>${consumer.version}</version>
            </dependency>

            <!-- swagger2 -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${swagger2.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${swagger2.version}</version>
            </dependency>

            <!-- mysql driver -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector-java.version}</version>
            </dependency>

            <!-- druid -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>

            <!-- mybatis -->
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>${mybatis-spring-boot-starter.version}</version>
            </dependency>

            <!-- util -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${commons-collections4.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-pool2</artifactId>
                <version>${commons-pool2.version}</version>
            </dependency>

            <!--&lt;!&ndash; rabbit &ndash;&gt;-->
            <!--<dependency>-->
                <!--<groupId>org.springframework.boot</groupId>-->
                <!--<artifactId>spring-boot-starter-amqp</artifactId>-->
            <!--</dependency>-->

            <!--&lt;!&ndash; web &ndash;&gt;-->
            <!--<dependency>-->
                <!--<groupId>org.springframework.boot</groupId>-->
                <!--<artifactId>spring-boot-starter-web</artifactId>-->
            <!--</dependency>-->

            <!--&lt;!&ndash; starter &ndash;&gt;-->
            <!--<dependency>-->
                <!--<groupId>org.springframework.boot</groupId>-->
                <!--<artifactId>spring-boot-starter</artifactId>-->
            <!--</dependency>-->

            <!--<dependency>-->
                <!--<groupId>org.springframework.boot</groupId>-->
                <!--<artifactId>spring-boot-starter-test</artifactId>-->
                <!--<scope>test</scope>-->
            <!--</dependency>-->
        </dependencies>
    </dependencyManagement>
</project>

 

posted on 2018-09-06 10:28  唐群  阅读(529)  评论(0编辑  收藏  举报