idea maven项目手动导入本地jar包的解决方案

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

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

<dependency>
	<groupId>xxxgroupId>
	<artifactId>xxxartifactId>
	<version>1.0.0version>
	<scope>systemscope>
	<systemPath>${project.basedir}/lib/xxx-1.0.0.jarsystemPath>
dependency>

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

idea maven项目手动导入本地jar包的解决方案_第1张图片

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

<plugin>
	<groupId>org.springframework.bootgroupId>
	<artifactId>spring-boot-maven-pluginartifactId>
	<executions>
		<execution>
			<goals>
				<goal>repackagegoal>
			goals>
		execution>
	executions>
	<configuration>
		<includeSystemScope>trueincludeSystemScope>
	configuration>
plugin>

即可解决问题

你可能感兴趣的:(intellij-idea,maven,jar)