maven私服的配置使用方法
maven的倉庫分為本地倉庫,遠程倉庫和私服倉庫。
私服倉庫一般是公司內部私有的,內部進行維護的。公司員工連接私服,從私服中下載jar,或者將自身的jar傳到私服上。私服還可以從中央倉庫下載jar,當私服中沒用jar的時候,就會從中央倉庫下載。

搭建私服下載
下載 Nexus,下載地址:http://www.sonatype.org/nexus/archived/ 。
可以選擇zip和tar,分別對應windows和linux。
安裝
將下載的zip解壓,使用cmd進入bin目錄,執(zhí)行命令:
nexus.bat install
卸載
執(zhí)行命令:
nexus.bat uninstall
啟動
1、cmd進入目錄,執(zhí)行命令
nexus.bat start
2、在服務中找到nexus,右鍵啟動
nexus配置文件詳細
查看 nexus 的配置文件conf/nexus.properties
application-port=8081 # nexus 的訪問端口配置
application-host=0.0.0.0 # nexus 主機監(jiān)聽配置(不用修改)
nexus-webapp=${bundleBasedir}/nexus # nexus 工程目錄
nexus-webapp-context-path=/nexus # nexus 的 web 訪問路徑
nexus-work=${bundleBasedir}/../sonatype-work/nexus # nexus 倉庫目錄
runtime=${bundleBasedir}/nexus/WEB-INF # nexus 運行程序目錄
訪問私服
http://localhost:8081/nexus/

點擊右上角log in,輸入用戶名和密碼

默認是admin/admin123
登錄完畢

上傳jar包到私服
在maven的setting.xml中配置
<server> <id>releases</id> <username>admin</username> <password>admin123</password> </server> <server> <id>snapshots</id> <username>admin</username> <password>admin123</password> </server>
配置項目的pom文件
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
使用deploy命令即可將jar發(fā)布到私服,發(fā)布工程中的version,如果以snapshot結尾,則可以發(fā)布到快照倉庫,如果以release結尾,則可以發(fā)布到releases版本。
從私服下載jar包
在setting中配置私服倉庫
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
激活
<activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles>
到此這篇關于maven私服的配置使用方法的文章就介紹到這了,更多相關maven私服配置使用內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
spring boot security 沒有合適的構造器問題
這篇文章主要介紹了spring boot security 沒有合適的構造器問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-12-12
使用JDBC連接Mysql 8.0.11出現了各種錯誤的解決
這篇文章主要介紹了使用JDBC連接Mysql 8.0.11出現了各種錯誤的解決,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-08-08
詳談Java中instanceof和isInstance的區(qū)別
下面小編就為大家?guī)硪黄斦凧ava中instanceof和isInstance的區(qū)別。小編覺得挺不錯的,現在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-01-01
通過FeignClient如何獲取文件流steam?is?close問題
這篇文章主要介紹了通過FeignClient如何獲取文件流steam?is?close問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-06-06

