網(wǎng)站首頁(yè) 編程語言 正文
一、將jar添加到本地倉(cāng)庫(kù)的做法:
以下面pom.xml依賴的jar包為例:
實(shí)際項(xiàng)目中pom.xml依賴寫法:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
打開你的cmd,輸入一下命令,Maven 安裝 JAR 包的命令是:
mvn install:install-file
-Dfile=jar包的位置
-DgroupId=上面的groupId
-DartifactId=上面的artifactId
-Dversion=上面的version -Dpackaging=jar
例如我的這個(gè)spring-context-support-3.1.0.RELEASE.jar 文件放在了"D:\mvn"中
則命令為:
mvn install:install-file
-Dfile=D:\mvn\spring-context-support-3.1.0.RELEASE.jar
-DgroupId=org.springframework
-DartifactId=spring-context-support
-Dversion=3.1.0.RELEASE
-Dpackaging=jar
注意:
- 任何路徑和名稱不要有中文和空格,以防出現(xiàn)莫名其妙的錯(cuò)誤。
- 在cmd窗口輸入命令,所有命令不要回車換行,最好在文本中縮進(jìn)為一行再?gòu)?fù)制過去運(yùn)行
還可以解決本地倉(cāng)庫(kù)是從別人那邊復(fù)制的,但是需要的jar包中央倉(cāng)庫(kù)不存在,導(dǎo)致的執(zhí)行package時(shí)出現(xiàn)以下異常
Failed to execute goal on project relayserver: Could not resolve dependencies for project com.xxx:xxx:war:1.0-SNAPSHOT: Failure to find xxx.xxx:xxx:jar:1.0 in http://maven.aliyun
.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced
二、不講jar包添加到本地倉(cāng)庫(kù)也可在maven工程中使用外部jar包的做法:
假設(shè)將包htmlparser.jar放入了項(xiàng)目下SRC下的Resouce的lib目錄中 :
-> ${project}/lib/htmlparser.jar
則pom.xml文件中依賴可以如下:
<dependency>
<groupId>com.htmlparser</groupId>
<artifactId>htmlparser</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/htmlparser.jar</systemPath>
</dependency>
原文鏈接:https://blog.csdn.net/qq_41512902/article/details/125850927
相關(guān)推薦
- 2022-09-14 Redis?緩存淘汰策略和事務(wù)實(shí)現(xiàn)樂觀鎖詳情_Redis
- 2022-11-07 使用react-native-doc-viewer實(shí)現(xiàn)文檔預(yù)覽_React
- 2022-09-25 linux系統(tǒng)下oracle數(shù)據(jù)庫(kù)的導(dǎo)入導(dǎo)出
- 2022-09-05 詳解apache編譯安裝httpd-2.4.54及三種風(fēng)格的init程序特點(diǎn)和區(qū)別_Linux
- 2022-07-10 docker的安裝及常用命令
- 2022-04-11 python制作簡(jiǎn)單計(jì)算器功能_python
- 2022-04-03 基于QT5實(shí)現(xiàn)一個(gè)時(shí)鐘桌面_C 語言
- 2023-04-01 Pytorch中關(guān)于F.normalize計(jì)算理解_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支