1,下载Nexus3,上传至服务器

下载地址:
链接:https://pan.baidu.com/s/13G56-C8FjCt2pRMx5BOrTQ
提取码:psm7

[root@VM-0-6-centos local]# tar xf nexus-3.12.0-01-unix.tar.gz
[root@VM-0-6-centos local]# cd nexus-3.12.0-01
[root@VM-0-6-centos nexus-3.12.0-01]#

2,添加环境变量export RUN_AS_USER=root:

[root@VM-0-6-centos nexus-3.12.0-01]# echo "export RUN_AS_USER=root" >> /etc/profile
[root@VM-0-6-centos nexus-3.12.0-01]# source /etc/profile
[root@VM-0-6-centos nexus-3.12.0-01]#

3,启动Nexus3

[root@VM-0-6-centos nexus-3.12.0-01]# cd bin
[root@VM-0-6-centos bin]# ./nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus

4,访问系统并创建用户、仓库

4.1 登录系统

访问地址:http://IP:8081/nexus
默认端口是8081
默认用户名/密码:admin/admin123

4.2 创建用户:


4.3 退出账户,使用刚创建的用户登录。

4.4 创建仓库:

4.4.1、四种仓库类型介绍
默认仓库介绍

1)maven-central: maven中央库,默认从https://repo1.maven.org/maven2/拉取jar

2)maven-releases: 私库发行版jar

3)maven-snapshots:私库快照(调试版本)jar

4)maven-public: 仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。

Nexus默认的仓库类型有以下四种:(上面的名字可以随便取,关键是它对应的是什么仓库类型)

1)group(仓库组类型):又叫组仓库,用于方便开发人员自己设定的仓库;

2)hosted(宿主类型):内部项目的发布仓库(内部开发人员,发布上去存放的仓库);

3)proxy(代理类型): 从远程中央仓库中寻找数据的仓库(可以点击对应的仓库的Configuration页签下Remote Storage Location属性的值即被代理的远程仓库的路径);

4)virtual(虚拟类型): 虚拟仓库(这个基本用不到,重点关注上面三个仓库的使用);

Policy(策略):表示该仓库为发布(Release)版本仓库还是快照(Snapshot)版本仓库;


创建1个proxy代理仓库,2个hosted宿主仓库,1个group仓库组。
其中代理仓库代理地址填写阿里云:http://maven.aliyun.com/nexus/content/groups/public/
创建仓库组时注意把其他几个仓库添加进去:

创建完成后的样子:

5,将jar发送到私服上

5.1 创建maven项目

使用idea 创建一个普通的maven项目:

在项目中创建一个Test.java(使项目能够打成jar包并上传到私服上)

5.2 编辑pom.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>untitled</artifactId><version>1.0-SNAPSHOT</version><packaging>jar</packaging><name>demo</name><description>Demo project for Spring Boot</description><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version></properties><!-- 配置jar向私服推送的仓库地址,推送时会根据版本不同推送到不同的仓库中  --><distributionManagement><repository><id>releases</id><url>http://IP:8081/repository/java-release/</url></repository><snapshotRepository><id>snapshots</id><url>http://IP:8081/repository/java-snapshot/</url></snapshotRepository></distributionManagement>
</project>

5.3 编辑本地maven的setting.xml

<servers><server><id>releases</id>  <!--对应pom.xml的id=releases的仓库--><username>ciems</username><password>ciems123</password></server><server><id>snapshots</id> <!--对应pom.xml中id=snapshots的仓库--><username>ciems</username><password>ciems123</password></server></servers><profiles><profile><!--ID用来确定该profile的唯一标识--><id>jdk-1.8</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion></properties></profile><profile><id>nexus-pr</id><!-- 远程仓库列表 --><repositories><repository><id>nexus-xu</id><name>Nexus Central</name><!-- 虚拟的URL形式,指向镜像的URL--><url>http://IP:8081/repository/java-group/</url><layout>default</layout><!-- 表示可以从这个仓库下载releases版本的构件-->  <releases><enabled>true</enabled></releases><!-- 表示可以从这个仓库下载snapshot版本的构件 -->  <snapshots><enabled>true</enabled></snapshots></repository></repositories><!-- 插件仓库列表 --><pluginRepositories><pluginRepository><id>nexus-xu</id><name>Nexus Central</name><url>http://IP:8081/repository/java-group/</url><layout>default</layout><snapshots><enabled>true</enabled></snapshots><releases><enabled>true</enabled></releases></pluginRepository></pluginRepositories></profile></profiles><activeProfiles><!--需要激活 <profile>中的ID才生效-->  <activeProfile>nexus-pr</activeProfile><activeProfile>jdk-1.8</activeProfile></activeProfiles>

使用idea中的maven插件推送jar到私服上

查看仓库:

6,从服务器上拉取jar文件

6.1 settings.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>D:/project/shengzong/repository/repo3</localRepository><pluginGroups></pluginGroups><!-- proxies| This is a list of proxies which can be used on this machine to connect to the network.| Unless otherwise specified (by system property or command-line switch), the first proxy| specification in this list marked as active will be used.|--><proxies></proxies><servers><!--第一个nexus-xu要和下面的mirror中的id一致,代表拉取是也需要进行身份校验--><server><id>nexus-xu</id><username>ciems</username><password>ciems123</password></server><!--这两个前面讲过,是jar上传时候进行的验证,id对应的是pom中id属性的值--><server><id>releases</id>  <!--对应pom.xml的id=releases的仓库--><username>ciems</username><password>ciems123</password></server><server><id>snapshots</id> <!--对应pom.xml中id=snapshots的仓库--><username>ciems</username><password>ciems123</password></server></servers><mirrors><mirror><id>nexus-xu</id><name>internal nexus repository</name><!--镜像采用配置好的组的地址--><url>http://IP:8081/repository/java-group/</url><mirrorOf>!internal.repo,*</mirrorOf></mirror></mirrors><profiles><profile><!--ID用来确定该profile的唯一标识--><id>jdk-1.8</id><activation><activeByDefault>true</activeByDefault><jdk>1.8</jdk></activation><properties><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target><maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion></properties></profile><profile><id>nexus-pr</id><!-- 远程仓库列表 --><repositories><repository><id>nexus-xu</id><name>Nexus Central</name><!-- 虚拟的URL形式,指向镜像的URL--><url>http://IP:8081/repository/java-group/</url><layout>default</layout><!-- 表示可以从这个仓库下载releases版本的构件-->  <releases><enabled>true</enabled></releases><!-- 表示可以从这个仓库下载snapshot版本的构件 -->  <snapshots><enabled>true</enabled></snapshots></repository></repositories><!-- 插件仓库列表 --><pluginRepositories><pluginRepository><id>nexus-xu</id><name>Nexus Central</name><url>http://IP:8081/repository/java-group/</url><layout>default</layout><snapshots><enabled>true</enabled></snapshots><releases><enabled>true</enabled></releases></pluginRepository></pluginRepositories></profile></profiles><activeProfiles><!--需要激活 <profile>中的ID才生效-->  <activeProfile>nexus-pr</activeProfile><activeProfile>jdk-1.8</activeProfile></activeProfiles>
</settings>

6.2 新建一个项目,并添加刚才推送上去的依赖

6.3 pom.xml 完整版

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>untitled1</artifactId><version>1.0-SNAPSHOT</version><name>demo</name><description>Demo project for Spring Boot</description><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version></properties><dependencies><dependency><groupId>org.example</groupId><artifactId>untitled</artifactId><version>1.0-SNAPSHOT</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><version>2.4.0</version></plugin></plugins></build><distributionManagement><repository><id>releases</id><url>http://IP:8081/repository/java-release/</url></repository><snapshotRepository><id>snapshots</id><url>http://IP:8081/repository/java-snapshot/</url></snapshotRepository></distributionManagement>
</project>

6.4 查看maven 依赖是否拉取下来

6.5 调用测试是否引入成功


jar 包拉取完成

参考博文:https://www.cnblogs.com/qdhxhz/p/9808642.html
博主写的更详细

Nexus3 私服搭建和配置相关推荐

  1. Maven Nexus3 私服搭建、配置、项目发布(docker方式)

    maven nexus私服搭建 访问nexus3官方镜像库,选择需要的版本下载:Docker Nexus docker pull sonatype/nexus3:3.49.0 创建数据目录并赋权 su ...

  2. 【Centos7内网环境Nexus3私服搭建】

    1.使用背景 在项目开发的过程中,我们通常在内部网络进行开发,在内网环境开发中我们经常遇到 Maven包.Npm包.Yum镜像.Docker镜像等无法联网下载问题,当然这些问题也可以通过离线安装的方式 ...

  3. nexus3私服搭建

    应用场景 maven库分为本地仓库和远程仓库(包括私服和中央仓库).公司自己设立,只为公司内部共享使用,同时减少外部访问和下载频率等. 使用Nexus搭建私服 下载 官网链接:https://www. ...

  4. Nexus 私服搭建及配置

    Nexus 学习 1. 安装及启动 下载地址 启动 ./nexus start 配置文件 nexus 有两个目录 nexus-3.21.1-01 安装 sonatype-work 数据文件 具体每个目 ...

  5. Docker容器搭建 Nexus3 私服

    Docker容器搭建 Nexus3 私服 1.介绍 2.搭建私服 2.1.下载nexus镜像 2.2.新建挂载目录 2.3.创建容器 2.4.访问nexus页 3.私服使用 3.1.私服配置 1.介绍 ...

  6. windows下使用nexus3.x搭建maven私服

    写在前面 本文描述了在windows下如何使用nexus3.x搭建maven私服,文章可能还有很多不足,请大家谅解,欢迎大佬提意见. 本文使用到的东西 nexus win10 文章目录 写在前面 本文 ...

  7. Maven 私服搭建指南

    序言 Maven 作为 Java 项目管理工具,它不仅可以用作包管理,还有许多的插件,可以支持整个项目的开发.打包.测试.部署等一系列行为. 而包管理又是其核心功能,除非是个人项目,我们获取包都是从中 ...

  8. maven伺服搭建_Maven私服搭建

    一.仓库:本地仓库.第三方仓库(内部中心仓库\私服).中央仓库 1.本地仓库:1).maven将工程中依赖的jar包(构件)从远程下载到本地某目录下管理,通常默认存储地址为${user.home}/. ...

  9. Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程

    使用IDEA打包上传到Nexus3私服 一.Nexus是什么 二.使用Nexus3搭建maven私服 三.IDEA打包上传到Nexus3私服 1.配置 .m2 下的 settings.xml 1.配置 ...

  10. maven私服搭建,sonatype nexus

    私服简介 https://blog.csdn.net/wuxiaobingandbob/article/details/79396239 1 . 私服简介 当 Maven 需要下载构件时,直接请求私服 ...

最新文章

  1. ndr4108贴片晶振是多少频率_王一博社交平台:抛开贴小广告的电线杆,字里行间可见真性情...
  2. hashmap储存有向图_如何在Rust中构建向量的HashMap?
  3. 运行wordcount.java_运行hadoop wordcount程序
  4. Hive安装报错:Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient的解决办法
  5. linux日志删除1天前,Linux自动删除n天前日志
  6. asp.net mvc项目中遇到的古怪的问题,(项目中有frame框架)
  7. tomcat中三种部署项目的方法(转)
  8. WebSocket 协议 RFC 文档(全中文翻译)
  9. 必备技能~程序员如何提高工作效率?如何更好获得领导的认可?
  10. erlang json: jsx,rfc4627,mochijson2,jsonx 简单比较
  11. iOS旧版微信SDK升级1.8.6版本小白踩坑记
  12. 网约车市场重构进行时,高端出行能否撬动大格局?
  13. 智慧物流:RFID智能仓储物流管理-RFID仓库管理解决方案-新导智能
  14. MySQL基础查询(单表查询)
  15. 滚动条三要素scrollTop clientHeight scrollHeight
  16. QML Canvas 绘制总结
  17. 记录Windows下有趣的cmd命令(持续更新)
  18. web开发入门经典,96道前端面试题
  19. MFC CListControl 点击列头排序的实现
  20. 女性买车,都在关注什么?

热门文章

  1. 微信小程序 授权登录功能实现
  2. mysql中的rman备份与恢复_RMAN备份与恢复实践(转)
  3. 吴恩达深度学习C4W1(Pytorch)实现
  4. MATLAB向量运算
  5. 大数据导论章节答案_智慧树APP大数据导论第三单元章节测试答案
  6. 开关电源matlab仿真文件,基于PI控制方式的7A开关电源的MATLAB仿真.doc
  7. 双线性的定义以及他的性质
  8. IE7和IE8的CSS样式不兼容
  9. scipy安装_4. Python--Scipy库(下/13-17)
  10. rs485接收中断函数使能_RS485通讯几种常见问题