通过mvn指令进行安装jar包时,总是安装在系统默认路径的解决办法,以及安装jar包时build failure问题解决办法

问题描述:

下图是使用mvn指令进行jar包的安装操作
mvn安装jar包的命令:

mvn install:install-file -Dfile=jar包的位置 -DgroupId=com.iot -DartifactId=mid_sdk -Dversion=1.0.0 -Dpackaging=jar

在这里插入图片描述
问题详情描述:
通过该命令安装它总是安装在系统盘(c盘),我已经设置了本地仓库的路径,且idea中也已经早就设置了路径为自己的路径,但是就是在安装jar包时,它总是给我安装在了默认的c盘路径下

20230906补充问题:
运行命令时,出现build failure问题
在这里插入图片描述
我就直接把这个问题的解决办法补充在这儿了:因为你放jar包的位置不能出现中文路径名,我在把jar包放在了一个没有中文路径名的位置,然后重新写了这个-Dfile=后面的内容,然后运行命令就成功安装了

问题排查:

在idea中设置的本地仓库是我自定义的D盘
在这里插入图片描述
查看mvn -version指令 看自己的mvn指令位置在哪儿 也可以看到在我自己设置的路径下:
在这里插入图片描述

解决办法:

找到自己的maven下的setting.xml文件
/conf/setting.xml
在这里插入图片描述
然后打开这个文件:
<localRepository>加入本地仓库的自定义路径/repository</localRepository>
在这里插入图片描述
成功解决,之后自己再通过mvn指令安装jar的时候就能够安装在自己定义的路径下了

关于最后使用的这个软件是notepad++ 它可查看所有的代码相关文件,且编辑提示非常的清晰

演示安装iTextAsian.jar包

执行命令:

mvn install:install-file -Dfile=D:\*****\intern_dingding\iTextAsian-2.1.7.jar -DgroupId=com.lowagie -DartifactId=iTextAsian -Dversion=2.1.7 -Dpackaging=jar

在这里插入图片描述

  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
D:\home\jdk11\bin\java.exe -Dmaven.multiModuleProjectDirectory=D:\showndoc\haikongweishi -Dmaven.home=D:\home\apache-maven-3.6.0 -Dclassworlds.conf=D:\home\apache-maven-3.6.0\bin\m2.conf "-Dmaven.ext.class.path=D:\home\IntelliJ IDEA 2021.1.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:D:\home\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=59520:D:\home\IntelliJ IDEA 2021.1.3\bin" -Dfile.encoding=UTF-8 -classpath D:\home\apache-maven-3.6.0\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2021.1.3 --offline -s D:\home\apache-maven-3.6.0\conf\settings.xml -Dmaven.repo.local=D:\home\apache-maven-3.6.0\mvn_resp install [INFO] Scanning for projects... [INFO] [INFO] -----------------------< com.dwi:haikongweishi >------------------------ [INFO] Building haikongweishi 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for org.apache.maven.plugins:maven-shade-plugin:jar:3.2.1 is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.240 s [INFO] Finished at: 2023-06-08T13:09:36+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Plugin org.apache.maven.plugins:maven-shade-plugin:3.2.1 or one of its dependencies could not be resolved: Cannot access alimaven (http://maven.aliyun.com/nexus/content/groups/public/) in offline mode and the artifact org.apache.maven.plugins:maven-shade-plugin:jar:3.2.1 has not been downloaded from it before. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException Process finished with exit code 1
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿,葱来了-C is coming

老板大气

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值