有时候我们引用了maven仓库不存在的第三方jar,项目打包后jar包里没有引用的jar,解决方法往下看
一:建立一个文件夹存入jar包(注意查看文件夹的样式) ,然后再pom.xml 里添加配置如图
代码如下:
<dependency>
<groupId>com.ngdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.14.10</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ngdbc-2.14.10.jar</systemPath>
</dependency>
二 :再在pom.xml里的 build里的<resources> 中添加 依赖
<resource>
<directory>${project.basedir}/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
三:再在pom.xml里的build 里的<plugins> 中添加依赖
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- true表示打包时包含scope为system的第三方的jar包 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
然后就正常打包了的程序了【以上三步缺一不可】