Nexus私服的安装和配置

第一步:下载nexus.war或者nexus.zip

1、如果是war包的话,直接拷贝到tomcat的webapps目录中,启动tomcat即可访问

http://localhost:8080/nexus/ 登陆名:admin 登陆密码:admin123
2、如果是zip包(注意:版本2.x的是压缩版,而3.x是需要分平台下载,也就是说有安装版)
我自己用的是2.xx版本的压缩包,解压后的bin\jsw目录下会有各个平台的启动项,继续需要以管理员身份运行。先运行install,在运行start。
2.xx版本可以手动上传jar包到repository目录下,3.xx版本就没有这个功能了。
下面参考博客:http://blog.csdn.net/zzq272804553/article/details/55045510

2.x版本的安装使用:

解压xxx.zip文件。

修改配置文件

2.x版本需要jdk1.7以上的支持,不然到时候启动会报错

3.x版本需要jdk1.8的支持,启动也会报错

压缩版如何修改jdk:

在bin/jsw/conf/wrapper.conf文件里

大概15行:

wrapper.java.command=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/bin/java(mac)

wrapper.java.command=C:\Program Files\Java\jdk1.7.0_60\bin\java.exe(winAll)

默认端口为:8081

修改配置:bin/conf/nexus.properties,修改第一行application-port=8082等等。


第二步:Nexus的介绍

登陆成功后点击Views/Repositories 中Repositories

Nexus 内置仓库说明:
1 Maven Central :该仓库代理 Maven 中央仓库,其策略为 Release ,因此只会下载和缓存中央仓库中的发布版本构件。
2 Releases :这是一种策略为 Release 的宿主类型仓库,用来部署组织内部的发布版本构件。
3 Snapshots :这是一个策略为 Snapshot 的宿主类型仓库,用来部署组织内部的快照版本构件。
4 3rd party :这是一个策略为 Release 的宿主类型仓库,用来部署无法从公共仓库获得的第三方发布版本构件。
5 Public Repositories :该仓库组将上述所有策略为 Release 的仓库聚合并通过一致的地址提供服务。
创建宿主目录和代理仓库
·  Hosted :本地仓库,通常我们会部署自己的构件到这一类型的仓库。
包括 3rd party 仓库, Releases 仓库, Snapshots 仓库
·  Proxy :代理仓库,它们被用来代理远程的公共仓库,如 maven中央仓库。
·  Group :仓库组,用来合并多个 hosted/proxy仓库,通常我们配置maven依赖仓库组。

第三步:创建仓库组

点击 Public Repositories 仓库,在 Configurations 栏中选取需要合并的仓库 , 点击箭头加到左边保存即可

第四步:下载Index索引并进行构建搜索(GAV搜索)(这个步骤我自己也不明确


第五步:配置所有构建均从私服下载,在~./m2/setting.xml中配置:
Maven的默认仓库是C:\Users\87623\.m2\repository 87623是当前用户名
./m2目录下是没有setting.xml的,需要把Maven下的conf目录下的setting.xml拷贝过去。
配置所有构建均从私服下载,在 ~/.m2/setting.xml 中配置如下:
<settings>
 <mirrors>
 <mirror>
 <!-- 此处配置所有的构建均从私有仓库中下载 * 代表所有,也可以写 central -->
 <id>nexus</id>
 <mirrorOf>*</mirrorOf>
 <url>http:// 192.168.1.100 :8000/nexus/content/groups/public</url>
 </mirror>
 </mirrors>
 <profiles>
 <profile>
 <id>nexus</id>
 <!— 所有请求均通过镜像  -->
 <repositories>
 <repository>
 <id>central</id>
 <url>http://central</url>
 <releases><enabled>true</enabled></releases>
   <snapshots><enabled>true</enabled></snapshots>
 </repository>
 </repositories>
 <pluginRepositories>
 <pluginRepository>
 <id>central</id>
 <url>http://central</url>
 <releases><enabled>true</enabled></releases>
 <snapshots><enabled>true</enabled></snapshots>
 </pluginRepository>
 </pluginRepositories>
 </profile>
 </profiles>
<activeProfiles>
 <!--make the profile active all the time -->
 <activeProfile>nexus</activeProfile>
 </activeProfiles>
 
  部署构建到 Nexus ,包含 Release Snapshot   在项目根目录中 pom.xml 中配置:
<distributionManagement>
<repository>
    <id>releases</id>
    <name>Internal Releases</name>
    <url>http://localhost:80 00 /nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
    <id> s napshots</id>
    <name>Internal Snapshots</name>
    <url>http://localhost:80 00 /nexu s /content/repositories/snapshots/</url>
</snapshotRepository>
  </distributionManagement>

Nexus 的访问权限控制,在 ~/m2/setting.xml 中配置如下:
<!-- 设置发布时的用户名 -->
 <servers>
  <server>
  <id> releases </id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id> s napshots </id>
<username>admin</username>
<password>admin123</password>
 </server>
 </servers>



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值