原文:http://blog.csdn.net/qqqqq210/article/details/52993337

1.简介

近期公司需要搭建jenkins自动化构建部署,需要搭建nexus私服环境,以便项目组的成员开发效率,以及打包发布,这样既节省了网络带宽也会加速项目搭建的进程, 当然前提条件就是你的私服中拥有项目所需的所有构件。

2.NEXUS下载(最新版3.1)

https://www.sonatype.com/download-oss-sonatype

3.安装

解压nexus-3.1.0-04-win64.zip, 
得到以下目录

1.nexus-3.1.0-04 nexus程序 
2.sonatype-work nexus工作目录 
(数据,备份nexus的时候可以备份这个文件夹)

nexus默认端口是8081

可以在nexus-3.1.0-04\etc\nexus-default.properties修改

配置系统环境变量

右击我的电脑-属性-高级-环境变量-系统变量区域(点击新增)

4.启动

cd nexus-3.1.0-04\bin目录下

常用命令
.nexus.exe /install 安装nexus为系统服务
.nexus.exe /uninstall 卸载nexus为系统服务
.nexus.exe /start 启动nexus服务
.nexus.exe /stop 停止nexus服务

启动后访问: http://127.0.0.1:8081/ 即可 
新版没用了项目名/nexus

默认登录: admin/admin123

登录之后才可以配置nexus私服

5.maven以及配置使用

no 废话,直接上配置 
1. 先在maven目录/conf/setting.xml的servers添加配置:

 <server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
  1. 工程中配置,发布/私服工厂
<!-- 配置私服工厂 -->
<repositories>
<repository>
<id>nexus</id>
<url>http://ip:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://ip:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- 配置发布到私服 -->
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Release Repository</name>
<url>http://ip:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Nexus Snapshot Repository</name>
<url>http://ip:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>

补充技巧

1.发布自定义jar到Nexus3

nexus 3.1版本去除了本地上传发布自定义jar

解决方案:
使用命令行进行本地jar上传 语法:
mvn deploy:deploy-file
-DgroupId=<group-id>\
-DartifactId=<artifact-id>\
-Dversion=<version>\
-Dpackaging=<type-of-packaging>\
-Dfile=<path-to-file>\
-DrepositoryId=<id-to-map-on-server-section-of-settings.xml>\
-Durl=<url-of-the-repository-to-deploy> 例子: mvn deploy:deploy-file -DgroupId=com.ojdbc7
-DartifactId=ojdbc7 -Dversion=1.0 -Dfile=ojdbc7.jar
-DrepositoryId=nexus -Durl=http://ip:prot/repository/maven-releases/

DrepositoryId=nexus指的是setting配置的验证的id

2.离线索引

参考博文:http://blog.csdn.net/lusyoe/article/details/52821088

由于使用代理之前需要先下索引,从国外下载的话非常的慢。可以翻墙或者可以使用常用的下载工具,下载后再上传到nexus服务器即可。 
http://repo.maven.apache.org/maven2/.index/ 找到需要下载的索引文件。 
如:http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz 
还有 
http://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.properties 
将其上传到nexus服务器存储数据的仓库中,对应web管理界面上就是Repository/Blob Stores/仓库名。 
在我的服务器上地址是在/var/opt/nexus-data/blobs/仓库名。 
在仓库名目录下创建.index目录,然后将下载的文件copy到该目录中,之后很快就同步好了,同步完成状态可通过查看web管理界面仓库状态栏,当出现Online - Remote Aviailable时就表示已同步完成了。 

1.简介

近期公司需要搭建jenkins自动化构建部署,需要搭建nexus私服环境,以便项目组的成员开发效率,以及打包发布,这样既节省了网络带宽也会加速项目搭建的进程, 当然前提条件就是你的私服中拥有项目所需的所有构件。

2.NEXUS下载(最新版3.1)

https://www.sonatype.com/download-oss-sonatype

3.安装

解压nexus-3.1.0-04-win64.zip, 
得到以下目录

1.nexus-3.1.0-04 nexus程序 
2.sonatype-work nexus工作目录 
(数据,备份nexus的时候可以备份这个文件夹)

nexus默认端口是8081

可以在nexus-3.1.0-04\etc\nexus-default.properties修改

配置系统环境变量

右击我的电脑-属性-高级-环境变量-系统变量区域(点击新增)

4.启动

cd nexus-3.1.0-04\bin目录下

常用命令
1.nexus.exe /install 安装nexus为系统服务
2.nexus.exe /uninstall 卸载nexus为系统服务
3.nexus.exe /start 启动nexus服务
4.nexu

默认登录: admin/admin123

登录之后才可以配置nexus私服

5.maven以及配置使用

no 废话,直接上配置 
1. 先在maven目录/conf/setting.xml的servers添加配置:

最新文章

  1. 【JavaEE企业应用学习记录】验证配置
  2. Linux下查看文件和文件夹大小
  3. HTTP基础08--追加协议
  4. 练习2:雨淋湿了一道题,9个数字只能看清楚4个,第一个肯定不是1 [X * (Y3 + Z)]^2 = 8MN9,求出各个数字
  5. IOS 支付宝-五福简单框架实现-线性滚动(UICollectionView)
  6. Hive安装(三)之奇怪的错误
  7. Linux下FTP服务(一)—— Ubuntu安装
  8. 如何为PHP贡献代码
  9. centos+php+coreseek+sphinx+mysql之二sphinx配置篇
  10. 独立开发游戏越来越容易:Unity 发布旗下的最新游戏引擎 Unity 5,依然有免费版(转)
  11. spring拦截器
  12. -_-#QUOTA_EXCEEDED_ERR: DOM Exception 22
  13. Lucene.Net 2.3.1开发介绍 —— 三、索引(四)
  14. 玩转nodeJS系列:使用原生API实现简单灵活高效的路由功能(支持nodeJs单机集群),nodeJS本就应该这样轻快
  15. iOS block和代理的区别
  16. string和double之间的相互转换(C++)
  17. retry.go
  18. Clion 配置
  19. C# NPOI 日期格式
  20. javascript面向对象精要第四章构造函数和原型对象整理精要

热门文章

  1. 分类IP地址(A、B、C类)的指派范围、一般不使用的特殊IP地址
  2. (转)配置Spring管理的bean的作用域
  3. Python——集合与字典练习
  4. Java8函数式编程和lambda表达式
  5. feign 负载均衡熔断器
  6. js运行机制(线程)
  7. vue+Java 前后端分离,多次请求Session不一致的问题(网络上找的)
  8. Spring框架针对dao层的jdbcTemplate操作crud之update修改数据库操作
  9. 2018 CCPC 女生赛 hdoj6287 口算训练
  10. 全新Ubentu系统没有make,gcc命令解决办法