maven nexus 的私服搭建

   apache的maven的出现不得不说是一件值得让全世界java程序开发者高兴的事情,因为这让我们摆脱了的各种各样jar包的依赖关系,版本不匹配的冲突问题,让我们通过一个简单的pom文件来管理这些jar包。

   要想用maven,首先得有maven,如果没有,请自行面(meng)壁(cuo),当下载完maven后,随便找一个目录解压。我就是将其解压到E:\apache-maven-3.2.1目录,接下来嘛就是配置classpath了,方法请参考JAVA_HOME的配置方法.完成后记得要验证:,如果出现这样就表示maven已经OK了,接下来则是要在myeclipse中配置maven插件,

如果没有settings.xml 记得要把maven安装路径的conf目录下的settings.xml复制过来,然后再修改配置,因为这样的修改操作只会影响操作当前的用户. 这样maven就整合到了myeclipse中了。

接下来该轮到私服了,点击下载,这样下载下来后同样解压到一个目录中去。我就是放在了E:\nexus-latest-bundle中,点击进入目录,E:\nexus-latest-bundle\nexus-2.8.1-01\bin\jsw,根据操作系统选择进去下一层目录,本人是window64的,因此进入E:\nexus-latest-bundle\nexus-2.8.1-01\bin\jsw\windows-x86-64目录中,如图:

点击install-nexus.bat 将其注册为服务,就避免了每次都要手动启动改了,然后在浏览器中输入http://localhost:8081/nexus,如果见到下图,则表明私服已经安装好了

既然说是私服,那么jar包应该从私服上下载,而再从远程仓库中下载了.那么接下来就要修改用户目录下的settings.xml了,

首先需要一个镜像配置

 <server>
      <id>nexusrepository</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
     <server>
      <id>nexuspluginRepository</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>

,让访问所有的仓库都映射到这个地址,

在配置一个认证信息

 <server>
      <id>nexusrepository</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>

,最后映射仓库

<profile>
      <id>nexus</id>
      <repositories>
        <repository>
        <id>nexusrepository</id>
            <name>215 private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
      
      </repositories>
      <pluginRepositories>
        <pluginRepository>
            <id>nexuspluginRepository</id>
            <name>local private nexus</name>
            <url>http://localhost:8081/nexus/content/groups/public/</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>      
       </pluginRepositories>
       
    </profile>

将上述配置激活,引用为上述配置的id

<activeProfiles>
    <activeProfile>nexus</activeProfile>   
  </activeProfiles>

至此全部完成


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值