zoukankan      html  css  js  c++  java
  • 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/"
     }

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

  • 相关阅读:
    C 语言 字符串命令 strstr()的用法 实现将原字符串以分割串分割输出
    C# 中对 IEnumerable IEnumerator yield 的理解
    C 语言 用字符输出菱形图案的函数(可自定义边长及字符样式)
    C 语言 对角线添充二维数组
    C 语言 边读 边写入文件
    [转]Page.RegisterRequiresRaiseEvent()与Page.RegisterRequiresPostBack()
    asp.net 判断是手机或电脑访问网页的方式
    表达式树【转】
    ADO.NET中的“返回多个结果集”和“MARS”【转】
    SQL2005转2000的方法【转】
  • 原文地址:https://www.cnblogs.com/exayong/p/6227502.html
Copyright © 2011-2022 走看看