Nexus私服的安装和配置

第一步:下载nexus.war包,然后拷贝到tomcat下的webapps目录中

第二步:启动tomcat

第三步:访问http://localhost:8080/nexus/显示如下:

 

第四步:点击右上角“log in”   ,输入username:admin 和Password:admin123登录

 

 

 

第五步:登录成功


第六步:点击Views/Repositories 中Repositories

 

Nexus内置仓库说明:

(1)Maven Central:该仓库代理Maven中央仓库,其策略为Release,因此只会下载和缓存中央仓库中的发布版本构件。

(2)Releases:这是一种策略为Release的宿主类型仓库,用来部署组织内部的发布版本构件。

(3)Snapshots:这是一个策略为Snapshot的宿主类型仓库,用来部署组织内部的快照版本构件。

(4)3rd party:这是一个策略为Release的宿主类型仓库,用来部署无法从公共仓库获得的第三方发布版本构件。

(5)Public Repositories:该仓库组将上述所有策略为Release的仓库聚合并通过一致的地址提供服务。

第七步:创建宿主目录和代理仓库

  • Hosted:本地仓库,通常我们会部署自己的构件到这一类型的仓库。
    • 包括3rd party仓库,Releases仓库,Snapshots仓库
  • Proxy:代理仓库,它们被用来代理远程的公共仓库,如maven中央仓库。
  • Group:仓库组,用来合并多个hosted/proxy仓库,通常我们配置maven依赖仓库组。

第八步:创建仓库组

         点击Public Repositories仓库,在Configurations栏中选取需要合并的仓库,点击箭头加到左边保存即可

 

第九步:下载Index索引并进行构建搜索(GAV搜索)

第十步:配置所有构建均从私服下载,在~/.m2/setting.xml(如果自己修改了默认的仓库路径则修改自己仓库的setting.xml文件,本人的maven本地仓库就放在D:\java\maven路径下)setting.xml配置如下:

<settings>

 <mirrors>

          <mirror>

                    <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->

                    <id>nexus</id>

                    <mirrorOf>*</mirrorOf>

<!--配置你的私服URL -->

                    <url>http://192.168.1.100:8000/nexus/content/groups/public</url>

          </mirror>

 </mirrors>

 <profiles>

          <profile>

                    <id>nexus</id>

                    <!--所有请求均通过镜像 -->

                    <repositories>

                             <repository>

                                      <id>central</id>

                                      <url>http://central</url>

                                      <releases><enabled>true</enabled></releases>

                                     <snapshots><enabled>true</enabled></snapshots>

                             </repository>

                    </repositories>

                    <pluginRepositories>

                             <pluginRepository>

                                      <id>central</id>

                                      <url>http://central</url>

                                      <releases><enabled>true</enabled></releases>

                                      <snapshots><enabled>true</enabled></snapshots>

                             </pluginRepository>

                    </pluginRepositories>

          </profile>

 </profiles>

<activeProfiles>

 <!--make the profile active all the time-->

 <activeProfile>nexus</activeProfile>

 </activeProfiles>

 

 

第十一步:部署构建到Nexus,包含Release和Snapshot,在项目根目录中pom.xml中配置:

分别配置自己发布的releasessnapsho版本的jar包到私服上的地址,一般都在父工程中配置

<distributionManagement>

         <repository>

            <id>releases</id>

            <name>Internal Releases</name>

            <url>http://localhost:8000/nexus/content/repositories/releases/</url>

         </repository>

         <snapshotRepository>

             <id>snapshots</id>

            <name>Internal Snapshots</name>

            <url>http://localhost:8000/nexus/content/repositories/snapshots/</url>

         </snapshotRepository>

  </distributionManagement>

第十二步:Nexus的访问权限控制,在~/m2/setting.xml中配置如下:

<!-- 设置发布时的用户名 -->

 <servers>

        <server>

                  <id>releases </id>

<username>admin</username>

<password>admin123</password>

</server>

<server>

<id> snapshots </id>

<username>admin</username>

<password>admin123</password>

 </server>

 </servers>

注意:如果这里我们使用的本地的仓库并修改了setting.xml文件,要复制一份到maven的全局配置文件,确保本地的和maven自带的全局配置文件一致(D:\java\apache-maven-3.0.5\conf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

愚人节第二天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值