nexus的使用

1、仓库类型
 hosted:本地仓库,通常我们会部署自己的构件到这一类型的仓库。比如公司的第二方库。
 proxy:代理仓库,它们被用来代理远程的公共仓库,如maven中央仓库。
 group:仓库组,用来合并多个hosted和proxy仓库。
在这里插入图片描述
2、版本类型
 Releases稳定版本。
 Snapshot快照版本.
3、搭建仓库
(1)、点击Repositories的Add按钮,选择Hosted Repository:
在这里插入图片描述
(2)、配置Hosted Repository
在这里插入图片描述
(3)、点击save,仓库就搭建成功了
在这里插入图片描述
4、使用私服仓库
(1)、maven的setting.xml文件配置。 注意:这里的id一定要和你项目中的私服地址id一模一样,如果这里的用户名密码写错了,会报错:401 ReasonPhrase: Unauthorized.。
在这里插入图片描述
(2)、pom.xml文件配置
在这里插入图片描述
(3)、发布到私服,maven项目使用命令:mvn clean deploy。或者在idea的右边找到Maven Projects,点击Lifecycle中的deploy。
在这里插入图片描述
在这里插入图片描述
使用私服的插件:

<pluginRepositories>
    <pluginRepository>
        <id>maven-test</id>
        <name>test</name>
        <url>http://192.168.106.130:8085/nexus/content/repositories/maven-test/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

如果想本机所有的maven项目都使用私服的组件,可以在maven的设置文件settings.xml中添加属性,并激活:

<profiles>
    <profile>
        <id>nexusProfile</id>
        <repositories>
            <repository>
                <id>nexus</id>
                <name>nexus</name>
                <url>http://192.168.1.103:8081/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>
<!-- 激活 -->
<activeProfiles>
    <activeProfile>nexusProfile</activeProfile>
</activeProfiles>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值