您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關(guān)maven無(wú)法下載依賴的jar包怎么辦,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。
公司內(nèi)部有搭建maven私服,自己做了個(gè)核心jar包,一開(kāi)始是xxx-core.1.0.0.SNAPSHOT版本,是本地和項(xiàng)目環(huán)境都可以正常使用的。為支持上線,發(fā)布穩(wěn)定版本,xxx-core.1.0.0.jar。
本地編譯正常,啟動(dòng)正常,項(xiàng)目環(huán)境,gitlab提交后自動(dòng)部署到Rancher時(shí),發(fā)現(xiàn)始終下載不下來(lái)jar包。
pom.xml文件的repository配置:
<repositories> <repository> <id>xxxxx.releases</id> <name>Releases</name> <url>https://nexus.xxxxxx.com/repository/maven-releases</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>xxxxxx.snapshots</id> <name>Snapshot</name> <url>https://nexus.huilianyi.com/repository/maven-snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository></repositories>
編譯時(shí)maven報(bào)錯(cuò)提示:
Failed to execute goal on project service: Could not resolve dependencies for project com.xxxxx:service:war:1.0-SNAPSHOT: Failure to find com.xxxxx-core:jar:1.0.0 in https://nexus.xxxx.com/repository/maven-releases was cached in the local repository, resolution will not be reattempted until the update interval of xxx.releases has elapsed or updates are forced -> [Help 1]
提示是說(shuō),是私庫(kù)配置的repository的這個(gè)id:xxx.releases 有緩存更新間隔,沒(méi)到這個(gè)更新時(shí)間,是從緩存里面獲取jar的,所以新上傳到倉(cāng)庫(kù)xxx-core.1.0.0.jar這個(gè)jar包是不在緩存里面的
所以沒(méi)有拉取下來(lái)。
解決辦法:
pom.xml更改為:
<repositories> <repository> <id>xxxxx.releases</id> <name>Releases</name> <url>https://nexus.xxxxxx.com/repository/maven-releases</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>xxxxxx.snapshots</id> <name>Snapshot</name> <url>https://nexus.huilianyi.com/repository/maven-snapshots</url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository></repositories>
<updatePolicy>標(biāo)簽是更新策略,always是總是下載倉(cāng)庫(kù)中最新的依賴。
更多相關(guān)內(nèi)容:
看完上述內(nèi)容,你們對(duì)maven無(wú)法下載依賴的jar包怎么辦有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。