Nexus 服务端

在部署 Nexus 私服 这篇文章中配置了 Nexus 的服务端,接下来要配置一下本地 maven 如何连接 Nexus 服务端使用。

Maven 私服配置

1、首先打开我们本地 maven 的配置文件

2、一般情况下我们会修改本地仓库位置

3、配置镜像仓库

  • 修改 <mirrors> 元素

    • id:需要与 <server> 中的 id 匹配
    • mirrorOf:可以填入 central (只有通过中央仓库下载的依赖才会从私服下载) 或 * (所有依赖均通过私服下载)
    • name:随便
    • url:仓库地址
<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><mirrors><mirror><id>nexus-public</id><mirrorOf>*</mirrorOf><name>Nexus Public</name><url>http://192.168.228.18:8081/repository/maven-public/</url></mirror></mirrors></pre>

如果 Nexus 服务端没有 开启匿名访问 的话,需要在 <server> 元素配置对应的访问认证信息, id 要与上面 mirror 中的 id 对应

<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><servers><server><id>nexus-public</id><username>admin</username><password>123456</password></server>
</servers></pre>

4、通过 mvn deploy 命令推送 jar 包到私服

  • 配置 <server> 访问认证信息
<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><servers><server><id>nexus-releases</id><username>admin</username><password>123456</password></server><server><id>nexus-snapshots</id><username>admin</username><password>123456</password></server></servers></pre>
  • 配置项目中的 pom.xml 文件,这里的 id 要与上面 server 中的 id 对应
<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><distributionManagement><repository><id>nexus-releases</id><name>Nexus Release Repository</name><url>http://192.168.228.18:8081/repository/maven-releases/</url></repository><snapshotRepository><id>nexus-snapshots</id><name>Nexus Snapshot Repository</name><url>http://192.168.228.18:8081/repository/maven-snapshots/</url></snapshotRepository>
</distributionManagement></pre>

完整的 pom.xml

<pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd"><localRepository>D:\repo</localRepository><servers><server><id>nexus-public</id><username>admin</username><password>123456</password></server><server><id>nexus-releases</id><username>admin</username><password>123456</password></server><server><id>nexus-snapshots</id><username>admin</username><password>123456</password></server></servers><mirrors><mirror><id>nexus-public</id><mirrorOf>*</mirrorOf><name>Nexus Public</name><url>http://192.168.228.18:8081/repository/maven-public/</url></mirror></mirrors>
</settings></pre>

npm 私服配置

在部署 Nexus 服务端 ,配置仓库的时候,我们知道 Nexus 不仅可以作为 maven 的私服,还可以作为 docker、apt、npm 等依赖管理工具的私服,这里我们配置一下 npm 私服仓库

1、配置代理仓库,代理淘宝镜像源

  • npm(proxy)
    <pre class="hljs coffeescript" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 0.75em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto;">npm-taobaohttps://registry.npm.taobao.org</pre>

2、配置私有仓库

  • npm(hosted)

    • Name: npm-hosted

3、配置分组仓库

  • npm(group)

    • Name: npm-public
    • Group:包含 npm-taobao 和 npm-hosted

Maven - 客户端 Nexus 配置相关推荐

  1. linux下mvn的运行配置,Linux内网环境下使用Nexus配置Maven私有仓库

    一. 安装配置Nexus 1. 下载nexus 2. 解压:tar -zxf nexus-3.5.2-01-unix.tar.gz 3. 进入bin目录启动:./nexus run & 出现如 ...

  2. 使用Nexus配置Maven私有仓库

    使用Nexus配置Maven私有仓库 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装配置Nexus 1>.下载nexus 下载地址:https://www.sonat ...

  3. 配置maven私服nexus

    1.Nexus简介 1.1 Nexus概述 Nexus是一个强大的Maven仓库管理器,它极大地简化了自己内部仓库的维护和外部仓库的访问. 利用Nexus你可以只在一个地方就能够完全控制访问和部署在你 ...

  4. maven 使用 Nexus 搭建私服并发布distributionManagement的配置使用

    可用两种方式安装启动nexus,下载在命令行启动,或者放到tomcat 下载并在命令行启动nexus 1.下载nexus(https://www.sonatype.com) 2.下载后解压文件,将解压 ...

  5. 配置Maven从Nexus下载构件

    配置Maven从Nexus下载构件  当需要为项目添加Nexus私服上的public仓库时,配置如下: <project>     ...     <repositories> ...

  6. Maven:私服Nexus的安装

    QUESTION:Maven:私服Nexus的安装 目录 QUESTION:Maven:私服Nexus的安装 ANWSER: 1.1 简介: 1.2 下载: 1.3 配置nexus 1.4 nexus ...

  7. Maven之Nexus局域网私服的搭建以及上传下载的测试

    Maven之Nexus局域网私服的搭建 公司在自己的局域网内搭建自己的远程仓库服务器,称为私服,私服服务器即是公司内部的maven远程仓库,每个员工的电脑上安装maven软件并且连接私服服务器,员工将 ...

  8. 从零开始的颜值评分 游戏项目 (一)Maven的相关配置 ——第一个SpringBoot小程序

    目录 一.项目背景 二.这个项目你可以学习到什么? 1.Maven的相关配置 1.1Maven简介 1.2Maven的相关配置 1.3Maven在IDEA中的配置 配置一: 配置二: 1.4 进行测试 ...

  9. Jenkins CI服务器搭建及Maven私服Nexus

    Jenkins CI服务器搭建及Maven私服Nexus 一:Jenkins持续集成(CI)1 1.1:Jenkins简介及特性1 1.2:Jenkins安装1 1.3:Jenkins配置1 1.4: ...

最新文章

  1. js监听audio播放完毕
  2. -Objc 、 -all_load 、 -force_load
  3. cygwin下如何运行crontab定时脚本?
  4. mysql-bin.000001文件的来源及处理方法[转]
  5. uni-app的列表搜索框_微信怎么搜索小程序?小程序能有什么用?
  6. python 勒索病毒 源码_python生成的exe被360识别为勒索病毒原因及解决方法
  7. 计算机专业术语全称及含义整理
  8. 手机怎么往服务器传文件,windows怎么用指令给手机传文件
  9. MOSS 2010:Visual Studio 2010开发体验(16)——客户端对象模型
  10. 洛谷P1880 石子合并 区间动归
  11. 网络安全与管理精讲视频笔记4-数字信封、数字签名、完整性验证、数据加解密及身份认证流程...
  12. 490 - Rotating Sentences
  13. 通过网络启动计算机,实现通过局域网唤醒计算机的两种方法
  14. 每日单词20110501
  15. 微信小程序前端合包流程weshop
  16. boost::math::binomial_distribution用法的测试程序
  17. python求单词长度_python 统计单词平均长度,统计a出现的次数
  18. Blender人物骨骼绑定
  19. 数字信号处理DFT实验二
  20. 华为私有云的搭建方案_Kali linux 搭建私有云

热门文章

  1. 使用python爬虫爬取最好大学网大学排名实例
  2. 面试被问到如何设计微信钉钉后端高并发IM架构?懵了.....
  3. 手机token登入软件_app开发调试工具_app开发token使用
  4. 机器学习指南_机器学习项目的研究指南
  5. shell批量替换文本中的多种字符串
  6. binutils工具集——ld的用法
  7. suse11sp3上面配置zypper源
  8. 话单数据采集简单了解
  9. Linux进程的概念
  10. 应用代码解决小学鸡兔同笼问题。(已知鸡和兔的总数量为n,总脚数为m。输入n和m,依次输出鸡和兔的数目。如果无解,则输出“no answer”。)