• ubuntu 搭建maven库 2.14.2-01并配置离线索引文件


    前提 安装JDK版本1.8或者以上

    1 下载

      http://www.sonatype.org/nexus/archived/  选择相应的版本

    2 复制到/usr/local 下解压

      sudo cp nexus-2.14.2-01-bundle.tar.gz /usr/local

      sudo tar -xzvf nexus-2.14.2-01-bundle.tar.gz

    3 设置运行权限 

      sudo  chown  用户名 nexus-2.14.2-01

      sudo chown 用户名 sonatype-work

      sudo chmod 777 nexus-2.14.2-01

      sudo chmod 777 sonatype-work

    4 设置环境变量(可选)

      sudo gedit /etc/profile

    加入(也可增加一个软链接)

      export $NEXUS_HOME=/usr/local/nexus-2.14.2-01

    如果想便捷一点也可加入PATH中

      PATH=$NEXUS_HOME/bin

    5 运行

      nexus start

    如果是nexus console 关掉后就停止了

    6 登录前台查看(下面是默认设置)

      127.0.0.1:8081/nexus

      用户名:admin

      密码:admin123

    7 下载并更新索引

      索引文件 wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz

      索引属性文件 wget http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties

      索引解压工具wget https://repo1.maven.org/maven2/org/apache/maven/indexer/indexer-cli/5.1.1/indexer-cli-5.1.1.jar

      

      把三个文件复制到 /usr/local/sonatype-work/nexus/indexer/central-ctx

      把properties文件解压到central-ctx目录下   

      解压缩 索引文件(注意要与下载的文件名称一致 ,网上看到运行命令java -jar indexer-cli-5.1.0.jar 一开始我没注意报 Error: Unable to access jarfile )

      java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d /.

      -d /. 表示解压到当前路径(  /usr/local/sonatype-work/nexus/indexer/central-ctx )

    8 重启nexus 并在登录前台查看

      nexus restart 

      登录-Repositories-Pulic Repositories-Browse Index 展开下面的Central 如果看到了索引列表则表示成功了

    9 使用:

      eclipse 在m2下的setting.xml中配置相应的仓库地址即可,地址就是对应的Repository Path

    比如Public Repositories 的 http://127.0.0.1:8081/nexus/content/groups/public/

    <mirror>
      <id>mynexus</id>
      <mirrorOf>cntral</mirrorOf>
      <name>my-maven</name>
      <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
    </mirror>

      id 和name的随便你自己填

    android-studio

     maven { 
       url "http://localhost:8081/nexus/content/groups/public/"
     }

    以上来自互联网,仅做个人笔记用。

  • 相关阅读:
    凡是可能出错的事必定会出错
    php session 前后台同域名下
    mysql常用; group by 高级
    Thread 学习记录 <1> -- volatile和synchronized
    VBA学习
    EXPLAINING WHAT ACTION AND FUNC ARE
    Unslider.js Tiny Sample
    jQuery操作DOM元素
    在.net中使用GAC
    Sql Server 分区演练 【转】
  • 原文地址:https://www.cnblogs.com/exayong/p/6227502.html
Copyright © 2020-2023  润新知