你有没有遇到过这样的问题:maven项目中引入本地jar包,在install的时候包程序包找不到
解决办法:
1、引入本地jar包
2、pom.xml中添加依赖
打包插件:<includeSystemScope>true</includeSystemScope>
这个非常重要,是将外部依赖打包进来的,如果没有该配置,打出来的jar包是不包含外部jar包的,从而可能会导致运行异常!
<!--外部依赖-->
<dependency>
<!--groupId和artifactId不知道随便写-->
<groupId>com.netsdk</groupId>
<artifactId>netsdk-api-main</artifactId>
<!--依赖范围,必须system-->
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<!--依赖所在位置-->
<systemPath>${project.basedir}/libs/netsdk-api-main-1.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- 这个配置很重要,是将外部依赖打包进来的,如果没有该配置,打出来的jar包是不包含外部jar包的 -->
<includeSystemScope>true</includeSystemScope>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>