nexus-搭建私服--踩坑记

本文详细记录了使用Nexus搭建私有Maven仓库的全过程,包括因官网下载问题采用迅雷下载Nexus安装包,以及Windows和Linux版本的下载链接。在配置和使用过程中,介绍了启动和停止Nexus仓库及Web服务的脚本,配置本地Maven settings.xml文件以及项目pom.xml文件的方法,确保能够发布和引用仓库中的依赖。此外,还分享了上传本地jar包的步骤。

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

本人把使用nexus搭建私服的过程踩坑的过程记录一下,主要包含以下问题

  • nexus安装包官网无法下载,应该被和谐了,使用把最终的下载地址使用迅雷下载,像百度网盘等离线下载不好使.迅雷就是牛.下载地址如下:
window:版本
https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.37.3-02-win64.zip
linux:版本
https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.37.3-02-unix.tar.gz
  •  相关的脚本如下:
<!-- 启动仓库服务 -->
bin/nexus run
<!-- 停止仓库服务,使用kill -9 命令 -->
<!-- 启动web服务-->
bin/nexus start
<!-- 停止web服务-->
bin/nexus stop

<!-- 访问程序网址: http://ip:端口(默认8081)/nextus(配置文件中配置,参照下图) -->
http://192.168.236.69:8081/nexus/
默认用户名:admin
密码:根据登录页面提示的文件中查找

  • 创建仓库
参照网页:
https://blog.csdn.net/u014756339/article/details/106808447
  • 创建用户:在maven配置文件中配置的是用户id和密码

  • 创建角色:

  • 本地maven配置 
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <localRepository>d:\repo_shenxi</localRepository>
    <pluginGroups>

    </pluginGroups>

    <proxies>
    </proxies>

    <servers>
        <server>
            <id>shenxi-releases</id>
            <username>deployment</username>
            <password>deployment</password>
        </server>
        <server>
            <id>shenxi-snapshot</id>
            <username>deployment</username>
            <password>deployment</password>
        </server>
    </servers>

    <mirrors>
        <mirror>
            <id>nexus</id>
            <mirrorOf>*,!jeecg,!jeecg-snapshots</mirrorOf>
            <name>nexus repository</name>
            <url>http://192.168.236.69:30000/nexus/repository/shenxi-public/</url>
        </mirror>
    </mirrors>
    <profiles>
        <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>nexus</id>
                    <url>http://192.168.236.69:30000/nexus/repository/shenxi-public/</url>
                    <releases>
                        <enabled>
                            true
                        </enabled>
                        <updatePolicy>
                            always
                        </updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>
                            true
                        </enabled>
                        <updatePolicy>
                            always
                        </updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>nexus</id>
                    <url>http://192.168.236.69:30000/nexus/repository/shenxi-public/</url>
                    <releases>
                        <enabled>
                            true
                        </enabled>
                        <updatePolicy>
                            always
                        </updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>
                            true
                        </enabled>
                        <updatePolicy>
                            always
                        </updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>
</settings>
  • 项目pom配置
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>test-mav</artifactId>
    <version>1.0-RELEASE</version>
    <dependencies>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.79</version>
        </dependency>
    </dependencies>
    <!-- 发布 -->
    <pluginRepositories>
        <pluginRepository>
            <releases>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>nexus</id>
            <url>http://192.168.236.69:30000/nexus/repository/shenxi-public/</url>
        </pluginRepository>
    </pluginRepositories>
    <distributionManagement>
        <repository>
            <!-- id一定要和maven setting中的配置一样 -->
            <id>shenxi-releases</id>
            <url>http://192.168.236.69:30000/nexus/repository/shenxi-hosted/</url>
        </repository>
        <snapshotRepository>
            <id>shenxi-snapshot</id>
            <url>http://192.168.236.69:30000/nexus/repository/shenxi-hosted/</url>
        </snapshotRepository>
    </distributionManagement>
</project>
  • 上传本地jar包(单个)

  • 上传本地jar包(批量)
<!--参照此网页:-->
https://blog.csdn.net/lihbps/article/details/104527652

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mengchanmian

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值