需要导入本地jar包,无法从私服或maven仓库下载jar包的情况下可以使用这个方法。

1:pom文件中写入需要导入的jar包配置

<dependency>
	<groupId>xxx</groupId>
	<artifactId>xxx</artifactId>
	<version>1.0.0</version>
	<scope>system</scope>
	<systemPath>${project.basedir}/lib/xxx-1.0.0.jar</systemPath>
</dependency>

2:将jar包放在systemPath对应的位置

在这里插入图片描述

3:为了在打包时将外部jar包打入项目中,需要在pom文件中添加此配置

<plugin>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-maven-plugin</artifactId>
	<executions>
		<execution>
			<goals>
				<goal>repackage</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<includeSystemScope>true</includeSystemScope>
	</configuration>
</plugin>

即可解决问题

更多推荐