第一种方法:
一、将要导入的jar包加载到本地仓库
在命令提示符内运行下列命令:
mvn install:install-file -Dfile=jar包路径.jar -DgroupId=自定义的groupid -DartifactId=自定义的artifactId -Dversion=自定义的版本号 -Dpackaging=jar
二、在pom.xml文件中导入对应依赖
<dependency>
<groupId>自定义的groupid</groupId>
<artifactId>自定义的artifactId</artifactId>
<version>自定义的版本号</version>
</dependency>
第二种方法:
一、
项目右键>>Open Module Settings>>libraries>>点击+号选择Java导入对应jar包
注意:这时系统会提示找不到对应jar包,因为还没有把jar包加载到本地maven仓库
二、
在idea的终端控制台运行命令
mvn install:install-file -Dfile=jar包路径.jar -DgroupId=自定义的groupid -DartifactId=自定义的artifactId -Dversion=自定义的版本号 -Dpackaging=jar
三、
在pom.xml文件中导入对应依赖
<dependency>
<groupId>自定义的groupid</groupId>
<artifactId>自定义的artifactId</artifactId>
<version>自定义的版本号</version>
</dependency>