将本地的JAR文件添加到你的Maven项目中的三种方法
1 将jar包放在lib文件夹下,再将lib添加进库
有两种方式:
一是右键lib目录,选择【添加为库】
二是文件->项目结构->库->新建项目库->选择lib
2 手动安装JAR到本地maven仓库
命令:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version>
groupId, artifactId, version 和packaging信息可以自定义\
在pom.xml中添加如下依赖,就可以在maven项目中使用了
<dependency>
<groupId>自定义group-id</groupId>
<artifactId>自定义artifact-id</artifactId>
<version>自定义version</version>
</dependency>
3 将jar包复制到项目中,然后在pom文件中配置jar包地址
将jar包复制到项目中,然后在pom文件中配置jar包地址,直接采用system 的范围,指定本地jar包的绝对路径
<dependency>
<groupId>xxxx</groupId>
<artifactId>xxxx</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/xxxx.jar</systemPath>
</dependency>