nexus3 私服
依赖查找顺序
项目使用时,先找maven ,如果没有,就再找nexus3,如果nexus3仓库中没有,就会再找 远程maven仓库,即:
maven本地仓库 -> nexus3私服 -> 远程maven仓库
返回过程中,会顺带把jar包保存在私服和maven中
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
安装
下载、启动
链接:https://pan.baidu.com/s/121u7FZdwYmnpD7_24vEqkw
提取码:dh8k
tar nexus-3.31.1-01-unix.tar.gz -C /usr/local
cd /usr/local/nexus-3.31.1-01/etc/
vim nexus-default.propertis #修改默认端口8081
cd ../bin
./nexus start
容器
mkdir -p /usr/local/docker_nexus/
chmod -R 777 /usr/local/docker_nexus/
docker run -itd \
--privileged=true \
-p 8081:8081 \
--name=nexus3 \
-v /usr/local/docker_nexus:/nexus-data sonatype/nexus3
仓库的类型
proxy #代理仓库,用来打通 私服nexus3跟远程仓库之间的通道,
#最右边的->中可以设置代理仓库地址 Proxy -> Remote storage http://maven.allyun.com/nexus/content/groups/publlc/
group #仓库组,把其他的一些仓库组组成一个组,点击最右边的 -> 可以把自己新建的仓库加入到组中,这样就不用多个配置了
hosted #宿主的仓库,用来发布内存的jar包或者是付费的jar包
布置本地仓库
设置 -> Repositories -> create Repository -> maven2 hosted (输入name 如maven-third ->create)
maven配置
代码中会先找家目录的m2下的settings,再找maven_home变量路径下的settings.xml
也可以直接在m2的settings中指定maven_home
settings.xml
1、先配置帐号和密码
<?xml version="1.0" encoding="UTF-8"?>
<settings xm1ns="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">
......
<servers>
<server>
<id>otoyix-releases</id>
<username>admin</username>
<password>admin123</password>
< / server>
<server>
<id>otoyix-snapshots</id>
<username>admin</username>
<password>admin123</password>
< / server>
</ servers>
......
#配置私有库的地址和插件库的地址
<profiles>
<profile>
<id>otoyix</id>
<activation>
<activeByDefault>false</ activeByDefault></activation> #如果这里是false,那么最下面需要三行激活块,见下
<!--私有库地址-->
<repositories>
<repository>
<id>otoyix /id>
<url>http://192.168.56.101:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</ repository>
</ repositories>
<!--插件库地址-->
<pluginRepositories>
<pluginRepository>
<id>otoyix< /id>
<url>http://192.168.56.101:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<activeProfiles> #这三行是激活此xdclass
<activeProfile>otoyix</ activeProfile>
</ activeProfiles>
</profiles>
存包 nexus3中
1、可以在IDE代码工具中把包deploy发送到仓库
注意ID要跟 xdclass-releases 、xdclass-snapshots 相同(发布库和快照库)
2、直接在nexus3中添加
最左侧 ->upload
-------------end