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/"
 }

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

 

转载于:https://www.cnblogs.com/exayong/p/6227502.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值