maven库中jar包引入不到idea项目,加载第三方jar包到本地maven库

开发中会遇到一些第三方jar的使用,但是添加到maven库后,怎么刷新都引入不到idea项目中,可以使用如下命令,在idea的Terminal窗口执行

执行命令:mvn install:install-file -Dfile=D:\Software\javabase64-1.3.1.jar -DgroupId=com.qdport  -DartifactId=javabase64 -Dversion=1.3.1  -Dpackaging=jar -DgeneratePom=true -DcreateChecksum=true

参数说明

1)Dfile:为 jar 包文件路径

2)DgroupId:一般为 jar 开发组织的名称,也是坐标 groupId

3)DartifactId:一般为 jar 名称,也是坐标 artifactId

4)Dversion:是版本号

5)Dpackaging:是打包类型

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Maven项目引入本地的jar有两种方式。 第一种方式是将本地的jar手动安装到本地的Maven,然后在项目的pom.xml文件相关的依赖。首先,将本地的jar安装到Maven,可以通过以下命令实现: ``` mvn install:install-file -Dfile=path/to/jarfile.jar -DgroupId=groupId -DartifactId=artifactId -Dversion=version -Dpackaging=jar ``` 其,`path/to/jarfile.jar`为本地jar的路径,`groupId`为指定的组织ID,`artifactId`为项目ID,`version`为版本号。安装成功后,可以在项目的pom.xml文件以下依赖: ``` <dependency> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>version</version> </dependency> ``` 替换其的`groupId`、`artifactId`和`version`为实际的值。 第二种方式是通过使用Maven的system scope将本地的jar引入项目。在项目的pom.xml文件以下依赖: ``` <dependency> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>version</version> <scope>system</scope> <systemPath>path/to/jarfile.jar</systemPath> </dependency> ``` 同样,需要替换其的`groupId`、`artifactId`、`version`和`path/to/jarfile.jar`为实际的值。 需要注意的是,第一种方式可以保证在其他机器上构建项目时也能正确引入jar,而第二种方式则需要保证在构建项目时本地的jar路径是正确的。因此,推荐使用第一种方式将本地的jar安装到Maven

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值