温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

maven中怎么安装私服 nexus

发布时间:2021-06-18 17:18:56 来源:亿速云 阅读:209 作者:Leah 栏目:大数据

maven中怎么安装私服 nexus,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

简介

  1. 私服不是Maven的核心概念,它仅仅是一种衍生出来的特殊的Maven仓库。通过建立自己的私服,就可以降低中央仓库负荷、节省外网带宽、加速Maven构建、自己部署构建等,从而高效地使用Maven。Nexus也是当前最流行的Maven仓库管理软件。

要求

  1. vps一台

  2. 系统centos7

  3. 内存大于1g

安装

  1. 这里我们使用docker进行安装,crt连接到vps

  2. yum -y install docker

    maven中怎么安装私服 nexus

  3. 启动docker: service docker start

  4. 查找nexus镜像 : docker search nexus

    maven中怎么安装私服 nexus

  5. 一般情况下,我们都是用stars最高的。docker pull docker.io/sonatype/nexus

  6. 启动nexus容器,对于以后的容器启动,[不清楚如何启动可以去docker hub 查看][https://hub.docker.com/],

    maven中怎么安装私服 nexus

  7. 一般直接搜索run 就可以找到如何启动

    maven中怎么安装私服 nexus

  8. 访问查看,管理员账户密码 admin admin123

    maven中怎么安装私服 nexus

  9. maven设置

    备注: pom中上传的设置id要与maven setting中的id保持一致。

    • setting.xml设置 maven中怎么安装私服 nexus

    • pom文件设置

      maven中怎么安装私服 nexus

      <repositories>
            <repository>
                <id>nexus</id>
                <name>Team Nexus Repository</name>
                <url>http://nexus.jetbrains.org.cn/nexus/content/groups/public</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>nexus</id>
                <name>Team Nexus Repository</name>
                <url>http://nexus.jetbrains.org.cn/nexus/content/groups/public</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>always</updatePolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>


      maven中怎么安装私服 nexus

        <distributionManagement>
            <repository>
                <id>releases</id>
                <name>Nexus Release Repository</name>
                <url>http://nexus.jetbrains.org.cn/nexus/content/repositories/releases/</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <name>Nexus Snapshot Repository</name>
                <url>http://nexus.jetbrains.org.cn/nexus/content/repositories/snapshots/</url>
            </snapshotRepository>
        </distributionManagement>


  10. 项目执行mvn delepoy 即可上传到私服。

  11. 至于releases库与snaoshots库的区别

    • 简单去说就是relesses库是稳定版本或者生产版本,snaoshots库是不稳定版本或开发版本,项目版本号后面带 -SNAPSHOT 的都会上传到snaoshots库。

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI