日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Maven入门教程(十四)-Nexus3.X私服下载资源

發布時間:2024/3/12 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Maven入门教程(十四)-Nexus3.X私服下载资源 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本章節主要講解如何將私服的資源下載到本地倉庫。

從圖中我們可以看到,當我們設置了私服后,系統會先在私服中查找是否有需要的資源,如果沒有則去遠程倉庫查找。

具體如何設置私服呢?步驟如下

首先我們需要在maven目錄下的config目錄下的setting.xml文件中配置私服信息

添加鏡像信息,將所有外網倉庫的請求指向私服:

?

<mirror><id>nexus</id><mirrorOf>*</mirrorOf><url>http://localhost:8081/repository/maven-public/</url></mirror>

此處的url我們配置的是group類型的倉庫組

這樣我們的私服就會按照group倉庫組里配置的私服地址依次查找資源是否存在

?

添加倉庫的配置

?

<profile><id>nexus</id><!--所有請求均通過鏡像 --><repositories><repository><id>central</id><name>Central Repository</name><url>https://repo.maven.apache.org/maven2</url><layout>default</layout><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>https://repo.maven.apache.org/maven2</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots> </pluginRepository></pluginRepositories></profile>

生效配置信息,activeProfile的值要和profile中的id內容一致

<activeProfiles><activeProfile>nexus</activeProfile></activeProfiles>

這樣我們私服的配置就完成了,完整的setting.xml文件如下

<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><pluginGroups></pluginGroups><proxies></proxies><servers> </servers><mirrors><mirror><id>nexus</id><mirrorOf>*</mirrorOf><url>http://localhost:8081/repository/maven-public/</url></mirror></mirrors><profiles><profile><id>nexus</id><!--所有請求均通過鏡像 --><repositories><repository><id>central</id><name>Central Repository</name><url>https://repo.maven.apache.org/maven2</url><layout>default</layout><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>https://repo.maven.apache.org/maven2</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots> </pluginRepository></pluginRepositories></profile></profiles><activeProfiles><activeProfile>nexus</activeProfile></activeProfiles> </settings>

?

總結

以上是生活随笔為你收集整理的Maven入门教程(十四)-Nexus3.X私服下载资源的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。