maven私服资源的上传与下载

Nexus安装与启动

1.Nexus是Sonatype公司的一款maven私服产品

  下载地址:https://help.sonatype.com/repomanager3/download

2.启动服务器(命令行启动)

nexus.exe /run nexus

3.访问服务器(默认端口:8081)

http://localhost:8081

4.修改基础配置信息

安装路径下etc目录中nexus-default.properties文件保存有nexus基础配置信息,例如默认访问端口。

5.修改服务器运行配置信息

安装路径下bin目录中nexus.vmoptions文件保存有nexus服务器启动对应的配置信息,例如默认占用内存空间。

6.先登录

7.允许匿名访问

8.私服仓库分为哪几种?

9.创建仓库

如果私服中没有对应的jar,会去中央仓库下载,速度很慢。可以配置让私服去阿里云中下载依赖

从私服中下载依赖

1.在maven的settings.xml中\<mirrors>标签中配置,此时就需要注释掉aliyun的配置。

<mirror>
    <id>maven-public</id>
    <mirrorOf>*</mirrorOf>
    <url>http://localhost:8081/repository/maven-public/</url>
</mirror>

上传依赖到私服中

1.配置本地仓库访问私服的权限(在maven的settings.xml的servers标签中配置)

<servers>
    <!-- 配置访问私服的权限-->
    <server>
        <id>itheima-release</id>
        <username>admin</username>   
        <password>admin</password>
    </server>
    <server>
        <id>itheima-snapshot</id>
        <username>admin</username>
        <password>admin</password>
    </server>
</servers>

3. 配置项目的pom.xml文件

<distributionManagement>
    <repository>
       <id>itheima-releases</id>
       <url>http://localhost:8081/nexus/content/repositories/itheima-releases/</url>
    </repository>
    <snapshotRepository>
       <id>itheima-snapshots</id>                          
       <url>http://localhost:8081/nexus/content/repositories/itheima-snapshots/</url>                        
    </snapshotRepository>
</distributionManagement>

3. 执行mvn deploy命令

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值