Maven打包时将外部jar包引入
情景:今天我们村花孙大俊写项目的时候需要引入一个她同事写的一个jar包,打包的时候未能将这个奇怪的jar包打入jar(SpringBoot项目);虽然我已经连着加班4 5天了,但是大俊的事情就是我的事情我还是积极的帮助大俊解决问题。
方法1.将这个jar包添加到本地的仓库中:
这个方法网上很多,但是我做的时候老是失败。。。怎么在仓库里边创建文件夹比较恶心。
方法2.在pom.xml文件中添加依赖:
-
<dependency> <groupId>xxx</groupId> <artifactId>xxx</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${project.basedir}/lib/xxx.jar</systemPath> </dependency> groupId,artifactId,version:这里可以随意定义; systemPath:这里需要你指定jar包所在位置.
2.重点
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <includeSystemScope>true</includeSystemScope> </configuration> </plugin>
需要Maven的打包plugin中添加:true