在使用Maven的时候,如果我们要依赖一个本地的jar包的时候,通常都会使用<scope>system</scope>和<systemPath></systemPath>来处理。
例如:
//引用本地jar包
<dependency>
<groupId>com.mytest</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/test-1.0.jar</systemPath>
</dependency>
如果你仅仅是这么做了,在你使用SpringBoot打包插件生成jar包的时候,你会发现这个jar包不会被打进去,进而出现错误。
(但是我配置到这一步我打的包里已经有这个jar包了????,,,不明所以????)
这个就需要在maven插接中配置一个includeSystemScope属性:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--设置为true,以便把本地的system的jar也包括进来-->
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
至此!完成!