maven+nexus搭建maven仓库
安裝maven
sudo wget http://mirrors.shu.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz tar axf apache-maven-3.5.2-bin.tar.gz sudo vim /etc/profile#MVN
export M2_HOME=/home/jenkins/apache-maven-3.5.2
export PATH=$PATH:${MAVEN_HOME}/bin
安裝nexus
下載地址:https://www.sonatype.com/download-oss-sonatype
tar axf nexus-2.14.6-02-bundle.tar.gz cd nexus-2.14.6-02/bin/修改環境變量
vim ~/.bash_profile#NEXUS
export NEXUS_HOME=/home/${USER}/nexus-2.14.6-02
export PATH=${PATH}:${NEXUS_HOME}/bin
web頁面訪問:http://localhost:8081/nexus
設置nexus開機啟動
sudo ln -s /home/${USER}/nexus-2.14.6-02/bin/nexus /etc/init.d/修改腳本
vim /etc/init.d/nexusNEXUS_HOME="/home/jenkins/nexus-2.14.6-02"
RUN_AS_USER=jenkins
重啟(restart啟動不了)
service nexus stop service nexus start設置nexus
點擊web頁面右上角的log in:http://localhost:8081/nexus
默認用戶密碼為:admin/admin123
添加一個用戶
創建maven倉庫
hosted 本地倉庫
proxy 代理倉庫
virtual 虛擬倉庫
repository group 倉庫組,用于整合多個倉庫
查看本地倉庫
將maven本地倉庫指向創建的nexus本地倉庫
vim ${M2_HOME}/conf/settings.xml添加如下一段,路徑請自行判斷
<localRepository>/home/jenkins/sonatype-work/nexus/storage/maven-repo</localRepository>
使用測試
mvn help:system該命令會打印所有java屬性和環境變量
第一次使用時會加載包
轉載于:https://blog.51cto.com/13323775/2069910
總結
以上是生活随笔為你收集整理的maven+nexus搭建maven仓库的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 走在技术前沿的 iOS 架构实现
- 下一篇: 用掘金-Markdown 编辑器写文章