1、Nexus仓库的分类
Nexus的仓库类型分为以下四种:
group:仓库组
hosted:宿主仓库
proxy:代理仓库
virtual:虚拟仓库
2、Nexus内置仓库介绍
Nexus预先配置了一些仓库、如果符合我们使用要求的话、则可以直接使用、简化配置。使用admin/admin123登录、点击左侧导航栏的Repositories链接:
Public Repositories: 仓库组
3rd party: 无法从公共仓库获得的第三方发布版本的构件仓库
Apache Snapshots: 用了代理ApacheMaven仓库快照版本的构件仓库
Central: 用来代理maven中央仓库中发布版本构件的仓库
Central M1 shadow: 用于提供中央仓库中M1格式的发布版本的构件镜像仓库,虚拟仓库的作用实际上是动态的将仓库内容格式转换、也就是为Maven1服务的(现都使用M2,Maven1格式仓库已经不再使用)
Releases: 用来部署管理内部的发布版本构件的宿主类型仓库
Snapshots:用来部署管理内部的快照版本构件的宿主类型仓库
一般我们通过仓库组,提供统一的服务,其实仓库组是对其他仓库的一种聚合。
3、配置Nexus作为我们的仓库
如果在某一具体项目的POM中配置、那只对当前项目有效、若想一次配置所有项目都使用、那么就是在settings.xml文件中配置、但是settings.xml中没有关于Repositeries配置、但是可以在<profiles><profile>标签中配置、然后激活<profile>配置文件、通过id关联、具体见下方详细配置信息:
<profile>
<id>jdk-1.7</id>
<activation>
<jdk>1.7</jdk>
</activation>
<repositories>
<repository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!--激活-->
<activeProfiles>
<activeProfile>jdk-1.7</activeProfile>
</activeProfiles>
其他好文推荐:http://blog.csdn.net/crave_shy/article/details/41015091
此文讲述了怎样将本地的jar和war发布到私有服务器Nexus中,值得学习!