cnetos7安装maven私服(nexus实现)

1、 版本选择

        官网包下载路径: Download Archives - Repository Manager 3 (sonatype.com)

nexus-3.70.1-02-java17-unix2.tar.gz (不推荐)包会报错。其依赖包最高只支持java11

nexus-3.70.1-02-java11-unix.tar.gz(推荐) 但是需要jdk11

 2、下载文档

        nexus-3.70.1-02-java11-unix.tar.gz 

  3、解压安装

tar -zxvf nexus-3.70.1-02-java11-unix.tar.gz  
cd nexus-3.70.1-02

4、 配置启动


# vim ./bin/nexus.rc # 指定root可以运行
# vim ./bin/nexus.vmoptions # 修改服务启动时的JVM配置,按需调整
# vim ./etc/nexus.properties  # 修改服务端口,默认8081
./nexus start
#  start-launchd # 如果没启动成功,可以使用这个查看实时日志,排除下问题

5、 访问服务

http://192.168.3.104:8081

可以配置nginx转发,配置域名(参见: 写文章-CSDN创作中心记一次Centos7局域网DNS服务器配置写文章-CSDN创作中心)

6、 仓库配置

 1) 重置密码

右上角-登录,使用使用默认密码(提示如下)

  

2) 查看仓库地址

3) 中央仓库代理

  • 设置-仓库-maven-central

  •  设置阿里云代理 

https://maven.aliyun.com/repository/public

7、 系统其他功能自行探索吧

        (参见: 超详细 | 使用Nexus搭建私服 (带代码演示)-CSDN博客 )

8、 本地仓库配置

apache-maven-3.8.5/conf/setting.xml配置

        1)  server

<!-- 私服账号和密码 -->
<server>
    <!-- 这个ID要用 -->
    <id>maven-releases</id>
    <username>admin</username>
    <password>admin</password>
</server>

<server>
    <!-- 这个ID要用 -->
    <id>maven-snapshots</id> 
    <username>admin</username>
    <password>admin</password>
</server>

        2) mirrors

   
	<mirrors>
        <!-- 私服 依赖下载仓库组 --> 
		<mirror>
			<id>maven-public</id>
			<name>gtm-public</name>
			<mirrorOf>*</mirrorOf>
			<url>http://maven.gobltree.vm/repository/maven-public/</url>
		</mirror> 


	</mirrors>

        3)  releases+snapshots都可以下载

<!-- 私服 仓库组哪些可以下载: releases+snapshots  -->
<profile>
   <id>allow-snapshots</id>
   <activation>
       <activeByDefault>true</activeByDefault>
   </activation>
   <repositories>
       <repository>
           <id>maven-public</id>
           <url>http://maven.gobltree.vm/repository/maven-public/</url>
           <releases>
               <enabled>true</enabled>
           </releases>
           <snapshots>
               <enabled>true</enabled>
           </snapshots>
       </repository>
   </repositories>
</profile>

9、项目配置

1) 配置本地打包上传

    <distributionManagement>
        <!-- release版本的发布地址 -->
        <repository>
            <id>maven-releases</id>
            <url>http://maven.gobltree.vm/repository/maven-releases/</url>
        </repository>
        <!-- snapshot版本的发布地址 -->
        <snapshotRepository>
            <id>maven-snapshots</id>
            <url>http://maven.gobltree.vm/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

2) 上传实验

弄个项目,打个包试试。 可算有了。 

下载的过程还有个问题:

1. 就是项目需要的包私仓库上没有,然后也没有去中心仓库找(这里代理的是国内阿里的仓库为中心仓库)。 且报错401:
Original error: Could not transfer artifact com.github.oshi:oshi-core:pom:6.6.1 from/to maven-public (http://maven.gobltree.vm/repository/maven-public/): authentication failed for http://maven.gobltree.vm/repository/maven-public/com/github/oshi/oshi-core/6.6.1/oshi-core-6.6.1.pom, status: 401 Unauthorized

解决办法就是中心仓库的:Auto blocking enabled:配置项。原因参见: Nexus 私服无法下载远程 Jar 包问题排查指南_auto blocking enabled-CSDN博客

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值