码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • maven 包管理平台-08-nexus 自己搭建 maven 仓库


    拓展阅读

    maven 包管理平台-01-maven 入门介绍 + Maven、Gradle、Ant、Ivy、Bazel 和 SBT 的详细对比表格

    maven 包管理平台-02-windows 安装配置 + mac 安装配置

    maven 包管理平台-03-maven project maven 项目的创建入门

    maven 包管理平台-04-maven archetype 项目原型

    maven 包管理平台-05-multi module 多模块

    maven 包管理平台-06-常用技巧 实时更新快照/乱码问题/下载很慢/包依赖解决包冲突/如何导入本地 jar

    maven 包管理平台-07-plugins 常见插件介绍

    maven 包管理平台-08-nexus 自己搭建 maven 仓库

    Nexus

    Nexus 是组织、存储和分发软件组件的最佳方式。

    下载

    下载

    安装方法:

    • 包含Jetty的捆绑包,只需 JRE。我选择了这种方式 nexus-2.13.0-01-bundle.tar.gz;

    • War,可以部署在Web上。

    安装

    将文件解压到所需位置。包含两个文件夹:

    • nexus-2.13.0-01 包含Nexus运行所需的内容。

    • sonatype-work 包含配置、仓库、日志文件。

    启动

    进入 bin 文件夹,在 ~/nexus-2.13.0-01/bin 中运行 nexus,您可能会得到:

    houbinbindeMacBook-Pro:~ houbinbin$ /Users/houbinbin/IT/learn/nexus/nexus-2.13.0-01-bundle/nexus-2.13.0-01/bin/nexus ; exit;
    Usage: /Users/houbinbin/IT/learn/nexus/nexus-2.13.0-01-bundle/nexus-2.13.0-01/bin/nexus { console | start | stop | restart | status | dump }
    logout
    Saving session...
    ...copying shared history...
    ...saving history...truncating history files...
    ...completed.
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    因此,只需运行以下命令即可启动 Nexus 服务器。

    /Users/houbinbin/IT/learn/nexus/nexus-2.13.0-01-bundle/nexus-2.13.0-01/bin/nexus start

      您可以在以下路径的文件 nexus.properties 中编辑 端口:

      ~/nexus/nexus-2.13.0-01-bundle/nexus-2.13.0-01/conf

        访问

        在浏览器中输入URL,然后您可以访问 Nexus 的仪表板。

        http://127.0.0.1:8081/nexus

          nexus 仪表板

          您可以在右上角登录 Nexus,默认管理员是:

          用户名:admin
          密码:admin123
          • 1

          Config

          在 setting.xml 中设置所有远程仓库使用内部仓库。

          
          
              
                  central
                  central-mirror
                  *
                  http://localhost:8081/nexus/content/groups/public/
              
          
          
          
              
                  
                  public-snapshots
                  
                      
                          public-snapshots
                          http://localhost:8081/nexus/content/groups/public
                          true
                          true
                      
                  
                  
                      
                          public-snapshots
                          http://localhost:8081/nexus/content/groups/public
                          true
                          true
                      
                  
              
          
          
          
              public-snapshots
          
          • 1
          • 2
          • 3
          • 4
          • 5
          • 6
          • 7
          • 8
          • 9
          • 10
          • 11
          • 12
          • 13
          • 14
          • 15
          • 16
          • 17
          • 18
          • 19
          • 20
          • 21
          • 22
          • 23
          • 24
          • 25
          • 26
          • 27
          • 28
          • 29
          • 30
          • 31
          • 32
          • 33
          • 34
          • 35

          Repository

          Remote Repository

          • 在 pom.xml 中设置
          
              
                  nexus
                  Team Nexus Repository
                  http://localhost:8081/nexus/content/groups/public
                  true
                  
                      true
                      ignore
                      daily
                  
              
          
          • 1
          • 2
          • 3
          • 4
          • 5
          • 6
          • 7
          • 8
          • 9
          • 10
          • 11
          • 12
          • 在 setting.xml 设置认证信息
          
              
              
                  
                      my-auth
                      usr
                      pwd
                  
              
          
          • 1
          • 2
          • 3
          • 4
          • 5
          • 6
          • 7
          • 8
          • 9

          在 setting.xml 中必须有一个 server,它的 id 与 pom.xml 中的相同,并且正确配置认证信息。

          在 pom.xml 中将项目部署到远程仓库。

          
              
                  releases
                  Nexus Releases Repository
                  http://localhost:8081/nexus/content/repositories/releases/
              
          
              
                  snapshots
                  Nexus Snapshots Repository
                  http://localhost:8081/nexus/content/repositories/snapshots/
              
          
          • 1
          • 2
          • 3
          • 4
          • 5
          • 6
          • 7
          • 8
          • 9
          • 10
          • 11
          • 12

          然后,使用以下命令可以部署它:

          mvn clean deploy

            在部署时需要进行身份验证。

            
                
                    releases
                    admin
                    admin123
                
                
                    snapshots
                    admin
                    admin123
                
            
            • 1
            • 2
            • 3
            • 4
            • 5
            • 6
            • 7
            • 8
            • 9
            • 10
            • 11

            默认角色:

            1) admin :对 Nexus 服务的完全控制权限,默认密码为 admin123

            2) deployment :能够访问 Nexus ,浏览仓库内容,搜索并且上传部署构件但无法配置 Nexus ,默认密码为: deployment123

            3) anonymous :对应所有未登录用户,可以浏览和搜索仓库

            Jar包存储地址默认为:

            ~/nexus/nexus-2.13.0-01-bundle/sonatype-work/nexus/storage

              镜像

              从 X 仓库获取的所有内容,也可以从它的镜像获取。

              实际上我喜欢这样配置:

              
                
                  nexus
                  *
                  http://localhost:8081/nexus/content/groups/public
                
              
              • 1
              • 2
              • 3
              • 4
              • 5
              • 6
              1. * 匹配所有远程仓库。

              2. external: * 匹配所有非本地主机的远程仓库。

              3. repo1, repo2 匹配 repo1 和 repo2...

              4. *, !repo1 匹配所有仓库,但不包括 repo1。

              注: 这个一般不用修改。

              Tips

              • Cannot deploy artifacts when Maven is in offline mode

              • 上传三方jar到 nexus

              点击【Add Artifact】-》点击【Upload Artifact(s)】

              参考资料

              intro zh_CN

              3rd zh_CN

              setting zh_CN 本文由博客一文多发平台 OpenWrite 发布!

            • 相关阅读:
              可用来文本 图片 音频 控制生成 图像 的网络结构
              Mybatis【全面学习 一篇就够】
              Linux学习之平均负载的概念和查看方法
              lenovo联想笔记本ThinkPad P1 Gen5/X1 Extreme Gen5原装出厂Windows11预装OEM系统
              Python信号之分享
              猿创征文|【概率论基础进阶】随机事件和概率-概率及概率公式
              CSS之flex布局
              DSA8300 泰克 Tektronix 数字采样示波器 简述
              前端中表单的使用
              C指针之初始化(三)
            • 原文地址:https://blog.csdn.net/ryo1060732496/article/details/136442953
            • 最新文章
            • 攻防演习之三天拿下官网站群
              数据安全治理学习——前期安全规划和安全管理体系建设
              企业安全 | 企业内一次钓鱼演练准备过程
              内网渗透测试 | Kerberos协议及其部分攻击手法
              0day的产生 | 不懂代码的"代码审计"
              安装scrcpy-client模块av模块异常,环境问题解决方案
              leetcode hot100【LeetCode 279. 完全平方数】java实现
              OpenWrt下安装Mosquitto
              AnatoMask论文汇总
              【AI日记】24.11.01 LangChain、openai api和github copilot
            • 热门文章
            • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
              奉劝各位学弟学妹们,该打造你的技术影响力了!
              五年了,我在 CSDN 的两个一百万。
              Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
              面试官都震惊,你这网络基础可以啊!
              你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
              心情不好的时候,用 Python 画棵樱花树送给自己吧
              通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
              13 万字 C 语言从入门到精通保姆级教程2021 年版
              10行代码集2000张美女图,Python爬虫120例,再上征途
            Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
            正则表达式工具 cron表达式工具 密码生成工具

            京公网安备 11010502049817号