maven(四)--搭建nexus私服,上传下载jar、源码jar

如题,本篇我们介绍下centos7中搭建nexus私服以及如何上传、下载jar包等。

一、centos7中安装nexus2

 下载nexus-2.14.4-03-bundle.tar.gz  ,上传到centos服务器

 cd  installpkg 

 tar  -zxvf    nexus-2.14.4-03-bundle.tar.gz   -C ../app/

 cd   ../app 

 mkdir  nexus2 

  mv   nexus-2.14.4-03   nexus2/

  mv    sonatype-work    nexus2/

  nexus服务启动、停止等命令 :

  cd nexus2/nexus-2.14.4-03/bin 
./nexus console 在当前控制台窗口启动,按ctrl+c结束进程
./nexus  start   后台进程启动nexus服务,可查看 logs目录中wrapper.log 输出日志
./nexus stop   停止nexus服务。

./nexus restart 重启 

./nexus  status 查看服务运行状态

注意:启动、停止服务,不要使用root账号(报错),使用一个其他的普通账户即可。

二、nexus2配置中央仓库,指向国内镜像(阿里云)

启动 nexus服务后,可使用浏览器访问 http://ip:8081/nexus 进入管理界面。

nexus中存在的内置账号 admin/admin123(管理员)  、 deployment/deployment123(部署员) 。

我们使用admin登录上后,找到左侧repository,找到central仓库

在configuration 中,我们发现 默认的remote storage location 值为: https://repo1.maven.org/maven2/,Download Remote Indexes 为False。

我们需要将remote storage location 值改为http://maven.aliyun.com/nexus/content/repositories/central/ ,Download Remote Indexes 值改为True

三、上传本地jar、源码jar到nexus私服

1、上传jar包到nexus私服 ,选择releases仓库,找到artifact upload 选项卡,填写GAV ,上传即可。

注意:选择的本地文件名可以是任意的,因为上传到nexus上后,nexus会根据jar的GAV坐标来重命名并保存起来(建立索引)

2、上传源码jar包到nexus私服 ,选择releases仓库,找到artifact upload 选项卡。填写GAV ,与上传jar相同。上传源码jar包还

需要配置classifier为sources  (注意不是source) ,然后点击添加、上传即可。

三、从nexus下载jar包、下载源码jar包

搜索、找到我们刚上传的 eucp-sms-sdk-1.3.3.jar 和eucp-sms-sdk-1.3.3-sources.jar ,点击download即可下载。 

ok!!!

猜你喜欢

转载自blog.csdn.net/jasnet_u/article/details/81210186