1.什么是nexus?
Neux:MAVEN的私有倉庫;
如果沒有私服,我們所需的所有構件都需要通過maven的中央倉庫和第三方的Maven倉庫下載到本地,而一個團隊中的所有人都重復的從maven倉庫下載構件,不利於包的管理和共用.
Nexus的安裝
2.x下載地址:https://help.sonatype.com/repomanager2/download cd /data wget https://download.sonatype.com/nexus/oss/nexus-2.13.0-01-bundle.tar.gz cd nexus-2.13.0-01/bin export RUN_AS_USER=root ./nexus start echo "export RUN_AS_USER=root" >> /etc/profile source /etc/profile 訪問:http://{ip}:8081/nexus/ 默認用戶名密碼 admin admin123
2.配置本地私有倉庫
a.在倉庫中,默認會在本地去查找插件,當未發現有插件時,會去第三方倉庫查找,跟系統上的yum挺像!當本地內未能查找到相應的插件,會通過代理(proxy)類型進行下載插件,配置就在Central-->Remote Storage Location:https://repo1.maven.org/maven2/;
我們將其改為阿里雲的maven遠程倉庫:http://maven.aliyun.com/nexus/content/groups/public/
b.配置完nexus,再去修改maven的settings配置
<?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"> <mirrors> <mirror> <id>lixiang</id> <mirrorOf>*</mirrorOf> <url>http://10.0.0.27:8081/nexus/content/groups/public/</url> </mirror> </mirrors> <profiles> <profile> <id>default</id> <repositories> <repository> <id>public</id> <url>http://10.0.0.27:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>default</activeProfile> </activeProfiles> </settings>
c.重啟服務后,新建了一個在本地構建的的測試job:test-zrlog
參考博客:https://yq.aliyun.com/articles/485293
參考博客(這個博客我並沒有做過,看着應該能走下去):http://blog.51cto.com/linuxg/1792086