nexus maven 私服搭建(mac)

本文详细介绍了Nexus3私服的下载、安装、配置流程,包括如何设置Maven项目的私服地址、从私服下载依赖及上传第三方项目jar。同时,解决了maven deploy 405错误的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

nexus 的作用

指定私服的中央地址、将自己的Maven项目指定到私服地址、从私服下载中央库的项目索引、从私服仓库下载依赖组件、将第三方项目jar上传到私服供其他项目组使用

下载

下载地址:https://www.sonatype.com/download-oss-sonatype
百度网盘:
链接: https://pan.baidu.com/s/1zrKiwe46Fa6-aVXUYNpUuQ 提取码: 55x7

安装

解压后,目录bin,执行

./nexus start
./nexus status
nexus is running.

打开http://localhost:8081/,admin/admin123
在这里插入图片描述

配置

  1. setting
     <server>
        <id>kaizhuo-releases</id>
        <username>admin</username>
        <password>admin123</password>
    </server>
    <server>
        <id>kaizhuo-snapshots</id>
        <username>admin</username>
        <password>admin123</password>
    </server>
    
  <profile>  
      <id>dev</id>
      <repositories>
        <repository>
          <id>Nexus</id>
          <url>http://localhost:8081/repository/kaizhuo-public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
       <pluginRepositories>  
        <!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->
        <pluginRepository>  
            <!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->
            <id>public</id>  
            <name>kaizhuo-public</name>  
            <url>http://localhost:8081/repository/kaizhuo-public/</url>  
        </pluginRepository>  
    </pluginRepositories>  
      <activation>
        <activeByDefault>true</activeByDefault>      
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>
 <activeProfiles>
    <activeProfile>dev</activeProfile>
</activeProfiles>
  1. pom
    <distributionManagement>
        <repository>
            <id>kaizhuo-releases</id>
            <name>kaizhuo-release</name>
            <url>http://localhost:8081/repository/kaizhuo-release/</url>
        </repository>
        <snapshotRepository>
            <id>kaizhuo-snapshots</id>
            <name>kaizhuo-snapshots</name>
            <url>http://localhost:8081/repository/kaizhuo-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

mvn deploy

 <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

version后缀要有SNAPSHOT

mvn deploy

问题

  1. mvn deploy 405
    distributionManagement的URL设置有问题,复制nexus配置Repositories中的URL
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值