• 搭建Nexus本地仓库


    1 下载nexus安装包  网址:http://www.sonatype.org/nexus/
       建议下载最新的版本,最新的版本支持比较新的jdk版本, 1.6 肯定是不行的,必须是1.7及其以上。

    下载所需安装包。http://pan.baidu.com/s/1ntzDWkL
    如果读者已经设置jdk 版本,且低于1.7. 则可以配置想要使用的 jdk 版本。 nexus-2.10.0-02injswconf, 目录 wrapper.conf 文件 ,
    找到 wrapper.java.command= F:/jdk1.7.0_71/bin/java.exe, 这样配置即可。
    2 启动nexus服务
    找到当前对应的版本,有32, 64 位。
        进入nexus的文件目录:.. exus-2.10.0-02injswwindows-x86-64下面,
          Installnexus.bat 表示安装nexus服务到window服务中去。
          Startnexus.bat  表示启动nexus服务。
          nexus.bat  表示启动nexus应用程序 。
          Resumenexus.bat  表示重启nexus 。
          Stopnexus.bat  表示停止nexus服务
       启动nexus 无需启动tomcat,只需要点击“nexus.bat "就可以启动。
       启动成功后 在浏览器地址栏中输入:
       http://localhost:8081/nexus/index.html
       如果看到nexus界面 说明启动成功。
    3 设置maven的setting.xml文件
       3.1 设置自定义的仓库
       默认仓库会保存在c盘的C:Usersyjx.m2下面,如果要使用自定义的仓库,则在setting.xml中添加下面的配置

    <localRepository>e:/repository</localRepository>

     3.2 设置镜像私服

    ?

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    <mirrors>

       <!-- mirror

        | Specifies a repository mirror site to use instead of a given repository. The repository that

        | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used

        | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.

        |-->

       <mirror>

         <id>nexus</id>

         <mirrorOf>*</mirrorOf>

         <name>Nexus Mirror</name>

         <url>http://localhost:8081/nexus/content/groups/public</url>

       </mirror>

         

     </mirrors>

    3.3 设置 profile

      

    ?

    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

    <profile>

          <id>nexus</id>

          <repositories>

            <repository>

              <id>nexus</id>

              <name>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>nexus</id>

              <name>Nexus</name> 

              <url>http://localhost:8081/nexus/content/groups/public</url>

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

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

            </pluginRepository>       

          </pluginRepositories>

        </profile> 

        <!--激活配置-->

        <activeProfiles>

            <activeProfile>nexus</activeProfile>

        </activeProfiles>

    保存文件。

    4 登录nexus  用户名admin  密码 admin123.

      进入Repository菜单,修改 Apache Snapshots,Codehaus Snapshots,Maven Central的Download Remote indexs 为true.

      并右击每一个仓库的 repair Index  ,进行更新index  并把所有的proxy类型的仓库添加到public repository中去。

      自己觉得比较好的其他的代理仓库如下:

      添加新的repository 即代理仓库, 代理仓库的remoteurl

      http://repository.jboss.org/nexus/content/groups/public/

      https://repository.jboss.org/nexus/content/groups/developer/

     6 备注

       如果你安装的jdk是1.7的版本或者更高,请使用nexus版本2.0以上的版本

     7 nexus 服务器的迁移

    nexus 他本身会吧要下载好的jar 包存储起来,下次就不会再去下载。

    他的storage 存储目录是: sonatype-work exusstorage

    sonatype-work 这个目录和 nexus 是同级的,nexus-2.10.0-02 与   onatype-work 在同一目录下,是自动创建的,迁移的时候只需要拷贝这些 storage 过去就可以了。

     

  • 相关阅读:
    动态tab页
    SQL Server附加数据库拒绝访问
    SQL window身份登陆 SQL server不能登陆
    SQL UPDATE 经典
    Char Varchar Nvarchar区别
    【OpenSSL】创建证书
    makecert 制作数字证书
    cer, pfx 创建,并且读取公钥/密钥,加解密 (C#程序实现)
    CompareValidator ASP控件
    XMLHelper 类
  • 原文地址:https://www.cnblogs.com/csharponworking/p/4098128.html
Copyright © 2020-2023  润新知