搭建nexus私服部署项目

目录

1、前言

2、添加release和snapshot版本库

3、配置idea中的Maven设置

4、配置maven的settings.xml文件

5、项目中使用maven部署


1、前言

前文主要讲述了maven私服nexus的搭建maven私服nexus搭建+mybatisplus使用-CSDN博客

本文将继续讲述搭建nexus私服有关的项目部署

首先,需要查看nexus是否启动

2、添加release和snapshot版本库

参照链接1中的 "7.7 配置私有仓库" 的方式完成release和snapshot版本库的添加,并添加到maven-public成员中。

3、配置idea中的Maven设置

4、配置maven的settings.xml文件

自定义本地仓库位置

<localRepository>D:\Java_env\maven\resp</localRepository>

server

注意:

id: 名字不能重复,和pom引入名称相同

username/password: nexus的登录用户名密码

<server>

<id>****-repository</id>

<username>admin</username>

<password>123</password>

</server>

<server>

<id>****-releases</id>

<username>admin</username>

<password>123</password>

</server>

<server>

<id>****-snapshots</id>

<username>admin</username>

<password>123</password>

</server>

mirror

注意:url:是nexus的maven-public

<mirror>

<id>aliyunmaven</id>

<mirrorOf>*</mirrorOf>

<name>阿里云公共仓库</name>

<url>https://maven.aliyun.com/repository/public\</url>

</mirror>

<mirror>

<id>****maven</id>

<mirrorOf>*</mirrorOf>

<name>****-repository</name>

<url>https://192.168.***.***:8081/repository/maven-public/</url>

</mirror>

profile

规范jdk版本(略)

nexus仓库配置

<profile>

<!--profile 的 id-->

<id>nexus</id>

<repositories>

<repository>

<!--仓库 id,repositories 可以配置多个仓库,保证 id 不重复-->

<id>nexus</id>

<!--仓库地址,即 nexus 仓库组的地址-->

<url>http://192.168.***.***:8081/repository/maven-public/</url>

<!--是否下载 releases 构件-->

<releases>

<enabled>true</enabled>

</releases>

<!--是否下载 snapshots 构件-->

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

</repositories>

<pluginRepositories>

<!-- 插件仓库,maven 的运行依赖插件,也需要从私服下载插件 -->

<pluginRepository>

<!-- 插件仓库的 id 不允许重复,如果重复后边配置会覆盖前边 -->

<id>public</id>

<name>Public Repositories</name>

<url>http://192.168.***.***:8081/repository/maven-public/</url>

<!--是否下载 releases 构件-->

<releases>

<enabled>true</enabled>

</releases>

<!--是否下载 snapshots 构件-->

<snapshots>

<enabled>true</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

</profile>

activeprofile

<activeProfiles>

<activeProfile>nexus</activeProfile>

</activeProfiles>

5、项目中使用maven部署

配置pom文件

XML 复制代码
    <distributionManagement>
        <snapshotRepository>
            <id>****-snapshots</id>
            <url>http://192.168.***.***:8081/repository/****-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>****-releases</id>
            <url>http://192.168.***.***:8081/repository/****-releases/</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>nexus</id>
            <url>http://192.168.***.***:8081/repository/maven-public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

maven部署deploy测试结果

控制台:"BUILD SUCCESS"

nexus私服网址打开查看


感谢阅读,码字不易,多谢点赞!如有不当之处,欢迎反馈指出,感谢!

相关推荐
数据龙傲天16 分钟前
1688商品API接口:电商数据自动化的新引擎
java·大数据·sql·mysql
带带老表学爬虫44 分钟前
java数据类型转换和注释
java·开发语言
千里码aicood1 小时前
【2025】springboot教学评价管理系统(源码+文档+调试+答疑)
java·spring boot·后端·教学管理系统
彭于晏6891 小时前
Android广播
android·java·开发语言
程序员-珍1 小时前
使用openapi生成前端请求文件报错 ‘Token “Integer“ does not exist.‘
java·前端·spring boot·后端·restful·个人开发
2401_857297912 小时前
招联金融2025校招内推
java·前端·算法·金融·求职招聘
福大大架构师每日一题2 小时前
23.1 k8s监控中标签relabel的应用和原理
java·容器·kubernetes
金灰2 小时前
HTML5--裸体回顾
java·开发语言·前端·javascript·html·html5
菜鸟一皓2 小时前
IDEA的lombok插件不生效了?!!
java·ide·intellij-idea
爱上语文2 小时前
Java LeetCode每日一题
java·开发语言·leetcode