第一步:下载nexus-webapp-1.9.2.4.war包,然后复制到tomcat下的webapps文件夹中

第二步:启动tomcat

第三步:訪问http://localhost:8080/nexus/显演示样例如以下:

9.Nexus私服安装配置-LMLPHP

第四步:点击右上角“log in”  ,输入username:admin和Password:admin123登录

9.Nexus私服安装配置-LMLPHP

第五步:登录成功

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdG90b3R1enVvcXVhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" border="0" style="width:908px; height:525px">

第六步:点击Views/Repositories中Repositories

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdG90b3R1enVvcXVhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" border="0">

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栏中选取须要合并的仓库,点击箭头加到左边保存就可以

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdG90b3R1enVvcXVhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" border="0">

第九步:下载Index索引并进行构建搜索(GAV搜索)

第十步:配置全部构建均从私服下载,在~/.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:8000/nexus/content/repositories/releases/</url>

</repository>

<snapshotRepository>

<id>snapshots</id>

<name>Internal Snapshots</name>

<url>http://localhost:8000/nexus/content/repositories/snapshots/</url>

</snapshotRepository>

</distributionManagement>

第十二步:Nexus的訪问权限控制,在~/m2/setting.xml中配置例如以下:

<!--设置公布时的username
-->

<servers>

<server>

<id>releases </id>

<username>admin</username>

<password>admin123</password>

</server>

<server>

<id> snapshots </id>

<username>admin</username>

<password>admin123</password>

</server>

</servers>

05-07 15:11