Spring Boot + Maven 引入本地依赖jar包

步骤一:

        <dependency>
            <groupId>cn.boommanpro</groupId>
            <artifactId>spring-boot-dependency</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/resources/lib/spring-boot-dependency-1.0.0-SNAPSHOT.jar</systemPath>
        </dependency>

1.groupId``artifactId与正常引入依赖一致
2.systemPath中为maven中自带的路径${project.basedir}
3.把想要依赖的jar放入相应目录即可 现在放入的是resources中的lib目录下

步骤二:
修改spring boot 插件相关配置

  <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
        </plugins>

核心为:<includeSystemScope>true</includeSystemScope>

©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页