标签:一个 tor snap centos 搭建 技术 过程 lease htm
怎么安装参见CentOS6.9安装Nexus3.19 ,接下来就是如何配置。打开我们安装后的nexus界面,用admin账号登陆,点击Server administration and configuration按钮:
点击Repository
我们可以看到nexus默认给我建好了一些仓库,其中包括3类:代理proxy,仓库组group和宿主host。
代理用来指向远程仓库的,如中央仓库,但毕竟国内的阿里云仓库比国外要快许多,所以我们自己建一个新的代理仓库。点击Create Repository:
选择maven2(proxy):
输入仓库名和远程仓库地址为http://maven.aliyun.com/nexus/content/groups/public:
拉到最下面点击Create Repository,返回上一层界面:
接着我们创建宿主仓库,宿主仓库跟我们的项目相关,用于上传我们打出来的包,分发布Release和快照Snapshots两种,所以我们就建两个宿主仓库,过程同上:
最后我们再创建一个仓库组,仓库组就像数据库的视图一样,能把多个仓库聚合起来用,记得把aliyun放在maven-central上面:
ok,现在我要的仓库都弄好了,接着配置maven的全局设置setting.xml文件。首先明确一下,nexus3.19的用户分两种:admin(能配置仓库、查询和上传构件)和anonymous(只能查构件):
我们新增一个角色deployment用于构建查询和上传,剥离admin的仓库管理,给开发人员使用:
然后新增一个角色nx-deployment:
再回去用户那里新增一个deployment用户:
最后,我们在setting中添加我们新加的宿主仓库的认证(我设置deployment用户的密码就是deployment123),配置镜像,让所有maven构建都走到镜像,经由镜像去请求仓库组,最后请求到我们配置的宿主仓库和代理仓库,大概脉络如下:
+---------------aliyun(proxy) :开源jar包
maven -> nexus(group) -> |---------------nexus-releases(host) :项目上传release的jar包
+---------------nexus-snapshots(host):项目上传snapshots的jar包
新建一个setting文件setting_nexus.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"> <localRepository>E:/Users/wulf/.m2/repository</localRepository> <mirrors> <mirror> <id>nexus</id> <name>nexus repository</name> <url>http://111.11.11.11/repository/nexus-group</url> <mirrorOf>*</mirrorOf> </mirror> </mirrors> <!-- 激活配置 --> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://111.11.11.11:17407/repository/aliyun</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://111.11.11.11:17407/repository/aliyun</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <servers> <server> <id>nexus-releases</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>nexus-snapshots</id> <username>deployment</username> <password>deployment123</password> </server> </servers> </settings>
新建一个maven项目跑一个看看:
maven执行日志:
Downloading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/maven-metadata.xml
Uploading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/spring-cloud-plugin-0.0.1-20201017.010507-1.jar
Uploaded: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/spring-cloud-plugin-0.0.1-20201017.010507-1.jar (8033 KB at 1523.3 KB/sec)
Uploading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/spring-cloud-plugin-0.0.1-20201017.010507-1.pom
Uploaded: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/spring-cloud-plugin-0.0.1-20201017.010507-1.pom (3 KB at 4.9 KB/sec)
Downloading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/maven-metadata.xml
Uploading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/maven-metadata.xml
Uploaded: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/0.0.1-SNAPSHOT/maven-metadata.xml (776 B at 2.9 KB/sec)
Uploading: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/maven-metadata.xml
Uploaded: http://106.53.42.25:17407/repository/nexus-snapshots/com/wlf/spring-cloud-plugin/maven-metadata.xml (286 B at 1.4 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.136 s
[INFO] Finished at: 2020-10-17T09:05:13+08:00
[INFO] Final Memory: 25M/210M
[INFO] ------------------------------------------------------------------------
去看一眼nexus的界面,nexus-snapshots的包成功打上去了:
标签:一个 tor snap centos 搭建 技术 过程 lease htm
原文地址:https://www.cnblogs.com/wuxun1997/p/13829839.html