一、安装私服
1、解压压缩包到非中文目录下
2、在 nexus-2.12.0-01 \ bin 目录下打开命令窗口,执行命令进行安装
3、查看服务,并且启动
或者使用命令启动:
4、浏览器进行访问
登录用户名密码分别为:admin、admin123
5、仓库类型
Virtual 虚拟仓库
Proxy 代理仓库
Hosted 宿主仓库 本地仓库
Group 组
二、私服的使用之上传jar到私服
1、在maven的settings.xml配置文件中配置上传属性
<!--上传jar到私服的配置 -->
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
2、在要上传的jar项目中的pom.xml中配置私服地址
<!-- 私服地址的配置 -->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
3、使用命令进行上传
4、查看私服
三、私服的使用之从私服上下载jar
1、在settings.xml中配置私服下载的设置
<!-- 下载私服jar包的配置 -->
<profile>
<!--profile的id,可以自定义-->
<id>dev</id>
<repositories>
<repository>
<!--仓库id,repositories可以配置多个仓库,保证id不重复-->
<id>nexus</id>
<!--仓库地址,即nexus仓库组的地址-->
<url>http://localhost:8081/nexus/content/groups/public/</url>
<!--是否下载releases构件-->
<releases>
<enabled>true</enabled>
</releases>
<!--是否下载snapshots构件-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
<pluginRepository>
<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
激活配置的仓库:
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
四、私服的卸载
1、卸载服务
2、删除settings.xml中的配置