nexus的搭建
来源:互联网 发布:建筑工程造价算法 编辑:程序博客网 时间:2024/06/03 20:04
本文转自http://www.cnblogs.com/meet/p/5060864.html
1.Nexus下载
下载地址:http://www.sonatype.org/nexus/go/
下载后的文件:nexus-2.11.4-01-bundle.zip
安装:直接解压到某个目录即可
解压后,会有两个目录:
nexus-2.11.4-01
sonatype-work :私服的默认仓库
1.1 将bin目录添加到环境变量中
D:\JavaDev\nexus-2.11.4\nexus-2.11.4-01\bin
1.2 配置java文件的路径
打开D:\JavaDev\nexus-2.11.4\nexus-2.11.4-01\bin\jsw\conf\wrapper.conf文件
修改wrapper.java.command=java为你的java.exe文件的路径
例如:
wrapper.java.command=D:\Program Files\Java\jdk1.7.0_07\bin\java
1.3 启动nexus
先安装:nexus install
然后启动:nexus start
C:\Users\Administrator>**nexus install**
wrapper | nexus installed.
C:\Users\Administrator>**nexus start**
wrapper | Starting the nexus service...
wrapper | Waiting to start...
wrapper | nexus started.
C:\Users\Administrator>
1.4 登陆nexus
地址:http://localhost:8081/nexus
默认用户名密码 admin/admin123
2.Nexus Repositories 介绍
2.1 Repositories介绍
在Nexus的Repositories中,主要有两种类型的工厂hosted和proxy
hosted本地工厂:只是面向内部服务的,面向局域网
3rd party :存放Maven中央仓库中没有的第三方jar包
Releases :存放Maven中提交的Releases项目
Snapshots :存放Maven中提交的Snaphots项目
proxy代理工厂:
Central:存放从Maven中央工厂中下载下来的jar包
例如:Central中需要配置Maven中央工厂的地址
Apache Snapshots:存放专门从Apache下载的Snapshots的jar包
Codehaus Snapshots:存放专门从Codehaus下载的Snapshots的jar包
2.2 Maven中配置Nexus Repositories
配置Maven不从Maven自身的中央工厂找jar包,而是从这个Nexus私服工厂中找jar包
临时配置(用户配置):表示只针对当前项目的配置方式,只要当前项目找jar包的时候是来Nexus中找,但是如果再有一个新项目。就还是从Maven中来下载jar包了
打开pom.xml添加配置
<
repositories
>
<
repository
>
<
id
>nexus</
id
>
<
name
>Nexus Repository</
name
>
<
url
>http://localhost:8081/nexus/content/groups/public/</
url
>
</
repository
>
</
repositories
>
其中url的值,就是Public repositories的URL值
全局配置:这样配置表示不管哪个项目,只要局域网内使用Maven下载jar包,都会来Nexus的私服工厂中来下载。
通过修改Maven的setting.xml的全局配置文件
增加一个或者多个profile配置
<
profiles
>
<
profile
>
<
id
>nexusProfile</
id
>
<
repositories
>
<
repository
>
<
id
>nexus</
id
>
<
name
>Nexus Repository</
name
>
<
url
>http://localhost:8081/nexus/content/groups/public/</
url
>
<!-- releases默认是true -->
<
releases
><
enabled
>true</
enabled
></
releases
>
<!-- snapshots默认是false -->
<
snapshots
><
enabled
>true</
enabled
></
snapshots
>
</
repository
>
</
repositories
>
</
profile
>
</
profiles
>
<
activeProfiles
>
<!-- 激活nexusRepo这个profile:只有激活才生效 -->
<
activeProfile
>nexusProfile</
activeProfile
>
</
activeProfiles
>
2.3 配置Nexus的镜像
配置Nexus的镜像的目的是:有时候我们每个开发人员需要在我们的私服中找jar包,但是如果私服中也没有的话,就会去Maven的中央工厂中找。可能会有这样的需求,就是你们开发人员不允许直接去中央工厂找jar包,你们所需要的jar包都来我们内部的私服来找。如果私服里也找不到,那就是找不到了【通知项目经理需要\*\*.jar包】
同样是在Maven的全局配置文件settings.xml中配置
<
mirrors
>
<
mirror
>
<
id
>nexusMirror</
id
>
<!-- 配置工厂镜像,只要mirror中配置的工厂需要找jar包,都来这个url中找[也就是都来私服中找]
即使在这个私服中找不到了,也不会去Maven的中央工厂中找
mirrorOf中配置的表示是工厂的id
central工厂位置:apache-maven-3.3.9\lib\maven-model-builder-3.3.9.jar\pom-4.0.0.xml
central工厂表示是Maven自己的工厂https://repo.maven.apache.org/
maven2,这个地址就是Maven默认去找jar包的一个Maven中央工厂
-->
<!-- 这里也可以使用*号来代替所有的工厂都使用这个镜像来获取jar包
<mirrorOf>nexus,central</mirrorOf>
-->
<
mirrorOf
>*</
mirrorOf
>
<
name
>Human Readable Name for this Mirror.</
name
>
<
url
>http://localhost:8081/nexus/content/groups/public/</
url
>
</
mirror
>
</
mirrors
>
当然,如果这里定义mirror,那上面定义的激活profile的定义就没什么意义了,可以直接注释掉
<
activeProfiles
>
<!-- 激活nexusRepo这个profile:只有激活才生效 -->
<!-- <activeProfile>nexusProfile</activeProfile> -->
</
activeProfiles
>
1.Nexus安装与配置
2.Nexus更新索引
3.发布Maven项目到nexus中
4.按项目类型分配不同的nexus工厂来发布不同的项目
- nexus的maven搭建
- 搭建自己的nexus
- nexus的搭建
- nexus(私服)的搭建
- Nexus的搭建以及使用
- 简单的搭建安装nexus
- Nexus搭建的maven 私库
- Nexus私服的搭建
- Maven私服Nexus的搭建
- nexus搭建
- Nexus搭建
- Nexus 搭建
- Linux(Ubuntu12.04)环境的Nexus搭建
- maven nexus 的私服搭建
- maven项目的nexus搭建私服
- 使用nexus搭建maven的私有库
- maven的私服搭建 Maven Nexus
- 【Maven】私服搭建-Nexus的安装
- Java StringBuffer和StringBuilder类
- Android Studio2.0应用结构解析
- 获取状态栏高度的方法
- vim 基本操作
- 关于redhat 文件名进行列表查看 日期显示乱码解决
- nexus的搭建
- 读书 -《传习录》
- Netty+Zookeeper实现一个类似Dubbo的RPC框架
- web环境配置中,日志的配置
- (c++)sum=2+5+8+11+14+…,输入正整数n,求sum的前n项和。
- Matlab自带的数据标准化方法(mapminmax和mapstd)详细解析
- html 5 触摸屏事件
- 在eclipse中用maven 创建springmvc项目
- maven部署的时候同时部署source.jar